[Question] Is it possible to set the face.normal?

[Question] Is it possible to set the face.normal?

Postby Pixero » Wed Jul 29, 2009 5:15 pm

Is it possible in SU to set the face.normal to a custom value?
Something like face.normal = customvector.
Useage would be to make certain faces have the same lighting as others even though they are not facing in the same direction. (Like when making grass planes or trees.)
Well, is it possible?
0
User avatar
Pixero 
 

Re: [Question] Is it possible to set the face.normal?

Postby thomthom » Wed Jul 29, 2009 5:55 pm

nope. Only thing you can do is reverse it.
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Question] Is it possible to set the face.normal?

Postby Pixero » Wed Jul 29, 2009 6:00 pm

:( And I just came up with this great idea for a plugin...
Well, well. SketchUp IS beginning to look more and more old...

And I guess there is no workaround? Like changing shadowinfo per face or setting a new normal through the vertices?
0
User avatar
Pixero 
 

Re: [Question] Is it possible to set the face.normal?

Postby Chris Fullmer » Wed Jul 29, 2009 6:12 pm

I know there are people on this forum who could probably help you hack into SU and implement your own shaders :)

Though that is against the installation agreement terms...

Chris
0
Lately you've been tan, suspicious for the winter.
All my Plugins I've written
User avatar
Chris Fullmer 
SketchUp Team
SketchUp Team
 

Re: [Question] Is it possible to set the face.normal?

Postby Pixero » Thu Jul 30, 2009 6:36 am

Even though shaders would be very nice to have in SU this isnt about that at all.
If we could set the normal of a face to a custom value (like for example 0,0,1) we could make better looking grass and trees since faces pointing in different directions wouldnt get different shades where they intersect.
So if there is a way please tell.


As a sidenote:
I know there are people on this forum who could probably help you hack into SU and implement your own shaders
Though that is against the installation agreement terms...
Chris


What about Adams LightUp? As far as I understand he is using his own OpenGL solution.
Wouldnt that be breaking the agreement?
If not why don't someone smart make a OpenGL implementation plugin for SU that gives us control to do more advanced stuff?
0
User avatar
Pixero 
 

Re: [Question] Is it possible to set the face.normal?

Postby Chris Fullmer » Thu Jul 30, 2009 5:33 pm

I believe that Adam is exporting geometry to his own renderer, then rendering his own textures for every surface, then applying all those rendered images back into the model, baking the entire model.

That is my understanding anyhow.

Chris
0
Lately you've been tan, suspicious for the winter.
All my Plugins I've written
User avatar
Chris Fullmer 
SketchUp Team
SketchUp Team
 

Re: [Question] Is it possible to set the face.normal?

Postby qpik » Thu Dec 17, 2009 12:37 am

During my research for improving raytesting plugin for SU
(http://forums.sketchucation.com/viewtopic.php?f=323&t=21077&st=0&sk=t&sd=a)
I've found out that Ruby supports OpenGL.

I mixed an example and library from Ruby installation.
You can run this example in SU (unzip 4 files to Plugins folder).
0

qpik 
 

Re: [Question] Is it possible to set the face.normal?

Postby thomthom » Thu Dec 17, 2009 8:18 am

and you managed to use that within SU?
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Question] Is it possible to set the face.normal?

Postby qpik » Thu Dec 17, 2009 9:52 am

So far I managed to run the example above. Give me some time :)
0

qpik 
 

Re: [Question] Is it possible to set the face.normal?

Postby Jim » Thu Dec 17, 2009 5:58 pm

I don't really know, but OpenGL must have hooks, or act as a server because of the existence of software such as 3D Printscreenwhich is able to capture the 3d Sketchup model and export it to some 3dxml format.

So if the OpenGL data can be "hooked" into, then does the possibility exist to use more OpenGL features not native to SU?

viewtopic.php?f=10&t=11943&p=84502&hilit=+shaders#p84502
0
Hi

Jim 
Global Moderator
 

Re: [Question] Is it possible to set the face.normal?

Postby thomthom » Thu Dec 17, 2009 6:07 pm

Isn't that what Adam B does with LightUp? Hook into the SU's OpenGL? All though, from C and not from Ruby.
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Question] Is it possible to set the face.normal?

Postby qpik » Thu Dec 17, 2009 10:42 pm

These are the libraries included in Ruby Windows installer:
http://ruby-opengl.rubyforge.org/.
0

qpik 
 

Re: [Question] Is it possible to set the face.normal?

Postby Chris Fullmer » Thu Dec 17, 2009 10:47 pm

But I'd still like to understand if you are getting this to interact with SketchUP somehow? Can you change what and how SU renders with this?

Chris
0
Lately you've been tan, suspicious for the winter.
All my Plugins I've written
User avatar
Chris Fullmer 
SketchUp Team
SketchUp Team
 

Re: [Question] Is it possible to set the face.normal?

Postby qpik » Thu Dec 17, 2009 11:32 pm

Yes you can! :D
I've just found the first thing that changed the view of the model.
I typed in the Ruby console glDisable(GL_DEPTH_TEST).
To see result try turning the model around.
Bear in mind that I'm just starting to learn OpenGL :roll: .

ps. You need to run SU with the files from the zip above in Plugins, except the example.
0
Last edited by qpik on Thu Dec 17, 2009 11:42 pm, edited 1 time in total.

qpik 
 

Re: [Question] Is it possible to set the face.normal?

Postby thomthom » Thu Dec 17, 2009 11:38 pm

Is this Windows and OSX compatible?
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: [Question] Is it possible to set the face.normal?

Postby qpik » Fri Dec 18, 2009 12:36 pm

I suppose so, try it on Mac.

Below is not however, only Windows. This seems to freeze SketchUp OpenGL.

Code: Select all
FindWindow = Win32API.new("user32.dll", "FindWindow", ['P','P'], 'N')
GetDC = Win32API.new("user32.dll", "GetDC", ['N'], 'N')
GetCurrentContext = Win32API.new("opengl32.dll", "wglGetCurrentContext", ['V'], 'N')
CreateContext = Win32API.new("opengl32.dll", "wglCreateContext", ['N'], 'N')
MakeCurrent = Win32API.new("opengl32.dll", "wglMakeCurrent", ['N','N'], 'V')
DeleteContext = Win32API.new("opengl32.dll", "wglDeleteContext", ['N'], 'V')


hwnd = FindWindow.call(0, "Untitled - SketchUp")
hdc = GetDC.call(hwnd)
hglrc = GetCurrentContext.call()
DeleteContext.call(hglrc)

I wonder if this is good direction?
0
Last edited by qpik on Fri Dec 18, 2009 1:44 pm, edited 1 time in total.

qpik 
 

Re: [Question] Is it possible to set the face.normal?

Postby Pixero » Fri Dec 18, 2009 1:10 pm

SU keep asking for glut32.dll. It's not in the zip you provided?
0
User avatar
Pixero 
 

Re: [Question] Is it possible to set the face.normal?

Postby qpik » Fri Dec 18, 2009 1:44 pm

Pixero wrote:SU keep asking for glut32.dll. It's not in the zip you provided?


It didn't ask me. Maybe because I have it in my Ruby installation.
0

qpik 
 

Re: [Question] Is it possible to set the face.normal?

Postby Pixero » Fri Dec 18, 2009 4:39 pm

So where can I get a Ruby install that has it?
0
User avatar
Pixero 
 

Re: [Question] Is it possible to set the face.normal?

Postby qpik » Fri Dec 18, 2009 5:10 pm

One-click windows installer has it. Here: http://rubyinstaller.org/
0

qpik 
 

Re: [Question] Is it possible to set the face.normal?

Postby Pixero » Sun Dec 20, 2009 5:52 pm

Anyone getting more than one line to work?
0
User avatar
Pixero 
 

Re: [Question] Is it possible to set the face.normal?

Postby qpik » Thu Mar 18, 2010 8:27 pm

I only got to change some OpenGL Server variables like GL_COLOR_MATERIAL or GL_DEPTH_TEST.
I don't know the way to hack into drawing context. I wonder how it is done in LightUp (supposing it is done similar way), maybe a window is layered on top of native SketchUp viewport.
0

qpik 
 

Re: [Question] Is it possible to set the face.normal?

Postby Chris Fullmer » Thu Mar 18, 2010 9:36 pm

I don't think Lightup does this. I think it renders materials and bakes them into faces in SU. At least that is my (severely limited and naive) understanding.
0
Lately you've been tan, suspicious for the winter.
All my Plugins I've written
User avatar
Chris Fullmer 
SketchUp Team
SketchUp Team
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 



 

Return to Developers' Forum

Who is online

Users browsing this forum: No registered users and 6 guests

Visit our sponsors: