PDA

View Full Version : VRML models and OpenGL Light



lunaverde
10-23-2003, 12:15 AM
I ve loaded VRML models into my OpenGL scene but the light has no effect on them. Is it possible to apply OpenGL lights to VRML models?

thx for every hint!

10-23-2003, 01:59 AM
Do VRML models hold any normal data? I don't recall seeing any last time I was playing with one.

Your problem is probably the normals. Calculate face normals properly, and your lighting should work fine.

lunaverde
10-26-2003, 10:07 PM
Actually I did the VRML models with 3d Studio max 5.0. and as far as I know the VRML exporter calculates normals. But in case it doesn't how can I calculate normals in OpenGL for an imported VRML model?

mikael_aronsson
10-27-2003, 01:02 AM
Hi !

As almost always, use google...

Have a look at: http://www.geocities.com/Paris/LeftBank/1160/normals.htm

Just to pick my first hit, it shows how to calculate the normals when you import the geometry (surface normals), if you want vertex normals it is a little more messy, but I would suggest you have a look at the source code for the Graphics Gems book's they contain code to do vertex normal calculations on meshes.

Mikael


[This message has been edited by mikael_aronsson (edited 10-27-2003).]