PDA

View Full Version : Specular Lighting Changes On Rotation Problem

paulg568
01-12-2012, 10:26 AM
Is specular lighting supposed to change based on rotation of the camera or position of the camera?

I thought the specular lighting changed based on the angle of the object from the eye and the light. Not the angle of the eye to the object.

Maybe it is correct but I don't think so. When i move my camera specular lighting on an object doesn't change. When I rotate the camera, then specular lighting changes.

Thanks for the help. If it is correct then I'll leave it if not I can post code maybe someone can tell me what is wrong with it.

awhig
01-12-2012, 01:22 PM
Is specular lighting supposed to change based on rotation of the camera or position of the camera?
Lighting will change only on rotation.

I thought the specular lighting changed based on the angle of the object from the eye and the light. Not the angle of the eye to the object.

In both cases it is true. Any motion ( either the camera, object or light source) such that view or light angle gets affected, the lighting (shading) will be affected.

Maybe it is correct but I don't think so. When i move my camera specular lighting on an object doesn't change. When I rotate the camera, then specular lighting changes.

Slightly vague for me to understand your point. Moving your camera means pure translation?

When you purely translate your camera, then your statement is correct. When you rotate your camera, you are changing the direction of your view vector.

I would like to add, in real world, when your camera purely translates in the same direction, lighting will be affected in terms of intensity - depending on the material properties of the object and the surrounding space ( imagine viewing your object in a foggy environment).

For normal ideal case, pure translation does not affect lighting.

ZbuffeR
01-12-2012, 03:43 PM
Pure camera translation does affect *specular* lighting.
Pure camera rotation should not affect any lighting.

awhig
01-13-2012, 12:10 AM
Pure camera translation does affect *specular* lighting.
Pure camera rotation should not affect any lighting.

Are you taking rotation in context of revolution around object or the camera center?

How does pure translation affect specular lighting ?? - I can think of a case when pure translation makes camera come in line of sight of incident or reflected ray; as specular is directional.

For diffuse ray pure translation will have effect on lighting.

awhig
01-13-2012, 12:18 AM
I guess, I am assuming pure translation to be 1-D( in the line of sight) instead of 3D. In that case the camera position gets affected and hence the lighting.

I guess the first poster meant rotation around axis rather than rotation around an object.

paulg568
01-16-2012, 10:08 PM
Thanks for everyones replies.

I was talking about pure camera rotation. Since the eye point isn't moving specular lighting should not change.

I fixed my problem with setting the light model.

glLightModelf(GL_LIGHT_MODEL_LOCAL_VIEWER, 1);

Also by updating the lights position after the call for gluLookAt.