View Full Version : Lighting and scaling

01-28-2004, 05:56 AM
I am working on a 3d application that is using Lighting luminate the IGES, STL or STLB file that it loads in. However the lighting attenuation is not working correctly when I scale the 3d object to a larger size. I found out that the attenuation calculations believe that it is getting further and further away from the object when in reality it is not. So in a nutshell, my light and object are on 2 different coordinate planes and it is messing up the lighting calculations. Does anyone have any suggestions?


01-28-2004, 06:58 AM
It could be possible that u have not tessalated the facing polygons. As the lighting calculation are done only on vertices and not the entire polygon, and it interpolates the lighting over the polygon. As the vertices move away from the light source its intensity decreases not only due to attenuation (which u enabled) but also as normal and light vector angle increase.
If this is the case then u can try tessalating the polygon, dividing it in no of triangle strips.

01-28-2004, 07:21 AM
You mentioned the magic word "scaling".
If you scale an object with the modelview matrix you must enable GL_NORMALIZE to get the normals correct again.
Check the OpenGL Programmers Guide appendix F, Transforming Normals.