View Full Version : Strange lighting problem with negative scaling
03-25-2003, 03:22 PM
So I have GL_NORMALIZE enabled, just so you know ;-)
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.
03-25-2003, 03:33 PM
I am not sure, but it sounds like you need to invert the direction of your normals.
normal.y = -normal.y
03-25-2003, 03:46 PM
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);
03-26-2003, 12:55 AM
Thanks! That pointed me to the problem!
Unfourtunatly all these steps are taken care of.
Here's a snippet of my code:
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?
[This message has been edited by zoldar256 (edited 03-26-2003).]
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.