PDA

View Full Version : Important Camera / Lighting problem



naaina
03-19-2003, 06:01 AM
Hi,

I don't know if this question fits into the advanced forum, but I'll try :)
So, I've written an engine, in which I load a 3DS File and also the lights. That works well, also the drawing of the geometry etc.
I just got one problem with the lighting:

When I have the specular lighting enabled on a light, it seems to move relative to the position of the camera. If I deactivate specular lighting, it doesn't. I searched through the web and found much articles how to fix the lights, also in the OpenGL FAQ - I use the technic described there, but it doesn't seem to work.

Or is the motion of the specular light with the camera normal?

Hope I will get some answers!

Thank you,
André

dawn
03-19-2003, 06:09 AM
Specular light is relative to the camera position. Look also on glLightModel.

naaina
03-19-2003, 06:15 AM
Thank for the answer, I already changed the Light Model Attribute for GL_LIGHT_MODEL_LOCAL_VIEWER, but then the specular is moving directly in front of my camera ....

Is there any other workaround except writing a complete new light engine based on lightmaps and such things?

cbwan
03-19-2003, 06:38 AM
> I don't know if this question fits into the advanced forum, but I'll try http://www.opengl.org/discussion_boards/ubb/smile.gif

maybe you should first try in the beginner's forum and come here if you don't have any answer http://www.opengl.org/discussion_boards/ubb/wink.gif

is the diffuse contribution of the light
moving with the camera?

if you set your light position (with glLight(GL_POSITION)) before you apply your camera transform, the light's position will be in eye's coordinates, so it will follow the camera.

if you set the position after your camera transform, it will be in world's coordinates and will not move when you move your camera.

hope this helps!
cb

naaina
03-19-2003, 01:27 PM
The specular contribution of the light is moving with the mouse, but I got already information, how the light is composed, and which parts are in relation to the "camera".

Yeah I set the light after the viewing transformation - I just need a solution how to get the specular light working without this moving....

naaina
03-19-2003, 01:36 PM
Oh sorry, I meant the camera, not the mouse http://www.opengl.org/discussion_boards/ubb/smile.gif