OpenGL lighting side-effects
Hi everybody,
OpenGL ligthing give me some matters.
I have a scene lighted in a correct way. The scene is traversed by different objects, such as cylinders and spheres; when a cylinder traverses the scene, lighting remain ok, but when I have a sphere, that changes the lighting of other objects in the scene, increasing it, also if for the sphere I'm using a material with all 0s light parameters.
Intuitively, the sphere reflects "more" than the cylinder (more faces), but I did not want any kind of this reflection; it seems that I got no such effect setting "diffuse" component at 0.0, but I need diffuse component in my lighting model.
What I need is, really, a very simple lighting model (just one light, maybe the Sun) where faces are lighted basing on their orientation, but avoiding them to reflect light over other objects. Is this possible? What I'm mistaking? Thanks in advance!
Francesco
OpenGL doesn't do any kind of global lighting, so one object moving will not change the other.
However, if the rendering of your objects "leak" state to other objects, then draw order will change what comes out on the screen -- that would be a bug in your code that uses OpenGL (it just does what you tell it to).
If you want a simple solution, use an existing scene graph like Ogre3D or OpenSceneGraph. If you want a complex solution, write your own scene graph (which sounds like what you're trying to do).
However, if the rendering of your objects "leak" state to other objects, then draw order will change what comes out on the screen -- that would be a bug in your code that uses OpenGL (it just does what you tell it to).
If you want a simple solution, use an existing scene graph like Ogre3D or OpenSceneGraph. If you want a complex solution, write your own scene graph (which sounds like what you're trying to do).
enum Bool { True, False, FileNotFound };
First make sure you have per-face or per-vertex normals enabled and defined. Then make sure that you are using the correct light model: POINT, DIRECTIONAL, and SPOT should all give you similar lighting models to a degree, but POINT is probably the closest to replicating the sun. AMBIENT light model will light all faces regardless of orientation towards the light. Also make sure you are positioning the light correctly and have the proper light components defined (ambient color, diffuse color).
http://blog.protonovus.com/
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement