PDA

View Full Version : Looking for the lighting culprit



chennes
07-18-2002, 06:47 AM
I have a scene in which I have a polygonal model. It is lit with a single directional light source which moves with the viewpoint. I have GL_NORMALIZE enabled (it's GL 1.1). For rotations/translations, this works fine, but when I zoom in, the scene gets progressively "flatter" until it appears as a grey mass with no lighting at all. Any suggestions as to the reason for this? I suspected the normals, but they *appear* to be fine (plus GL_NORMALIZE is on, so how could they go wrong??).

Thanks,
Chris

Michael Steinberg
07-18-2002, 08:31 AM
I hope you dont apply the transformations to the projection matrix? this ****s it all up with the lighting/fogging.

chennes
07-18-2002, 08:38 AM
Nope - modelview for all the transforms.

Chris

Michael Steinberg
07-18-2002, 08:43 AM
are you decreasing the fov in order to zoom in?

chennes
07-18-2002, 08:47 AM
No- it's an orthographic projection - I'm using glScale().

Chris

Michael Steinberg
07-18-2002, 08:51 AM
So then your problem is that opengl hw lighting is done per vertex. You need to either use per-pixel lighting in a pixel shader or subdivide the geometry.

Michael Steinberg
07-18-2002, 08:52 AM
Hmmm, you mean directional light or spotlight?

chennes
07-18-2002, 08:59 AM
Directional (infinite viewer type). Pixel shaders aren't really an option - I have to support pretty old hardware. I'm not clear on how GL's per vertex lighting combined with my ortho projection is causing this. I thought I had a decent grasp of the math - could you give a more technical explanation?

Chris

Michael Steinberg
07-18-2002, 09:04 AM
Sorry, i guess i was wrong, because the directional lighting doesnt take distance into account, only direction. Maybe this is an issue with the clipping and bad interpolation. I could use some pics.

chennes
07-18-2002, 09:38 AM
I can e-mail a set of images to anyone who wants to see - click on the e-mail symbol above to get my address and drop me a line.

Chris

JimmyT
07-19-2002, 06:50 AM
Are you using non-unform scaling?

chennes
07-22-2002, 03:33 AM
My scaling is uniform.

Thanks,
Chris

Jambolo
07-22-2002, 10:46 PM
Perhaps your glScale is affecting the direction of the light.

chennes
07-23-2002, 03:28 AM
I don't think the direction of the light is the problem (although at this point I'm not ruling anything out!). If the light direction changed I would expect to be able to see that as I zoom in. Instead, I observe a continuous flattening of the surface as I get closer - the light position doesn't appear to move, the lighting just gets crappier and crappier!!

Thanks,
Chris