Strange lighting problem with negative scaling

So I have GL_NORMALIZE enabled, just so you know :wink:
Yet when I try scaling any object in my scene by a negative scale, for reflection and such, all lighting disapears.
I’m drawing the objects out of triangles with a normal per vertex. Specifically using vertex and normal arrays, but I ca switch that to a bunch of glVertex calls and it has no affect on my problem.
Any ideas?

I am not sure, but it sounds like you need to invert the direction of your normals.

normal.y = -normal.y

Miguel Castillo

Shouldn’t the scaling transformations apply to the normals also?
Or else you’d have to consider what transformations ahve been applied when outputing normals. Which goes against the hierarchical coordinates paradigm.

Yes, scaling affects the normals as well… but you will get the wrong face order when you scale to -1, so make sure that all you material calls have GL_FRONT_AND_BACK as the first parameter, or change the windind order with glFrontFace(GL_CW);

Thanks! That pointed me to the problem!
Unfourtunatly all these steps are taken care of.
Here’s a snippet of my code:

glEnable(GL_LIGHTING);
glShadeModel(GL_SMOOTH);
glEnable(GL_NORMALIZE);
glEnable(GL_RESCALE_NORMAL);
glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE);
glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR);
CLight::resetLightIDs();
glFrontFace(GL_CW);

and the materials are applied to the front and back face. So really this should work.
But if I disable GL_LIGHT_MODEL_TWO_SIDE then both front faces and back faces are lit. I’m using OS X.2.4, and as this is contrary to the documentation I think it might be a bug. Anybody else with a similiar problem?
-Corey O’Connor

[This message has been edited by zoldar256 (edited 03-26-2003).]