Important Camera / Lighting problem


I don’t know if this question fits into the advanced forum, but I’ll try :slight_smile:
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,

Specular light is relative to the camera position. Look also on glLightModel.

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?

> I don’t know if this question fits into the advanced forum, but I’ll try

maybe you should first try in the beginner’s forum and come here if you don’t have any answer

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!

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…

Oh sorry, I meant the camera, not the mouse