View Full Version : Setting to make lighting dismiss normals?
For plants sprites, it would be better if the lighting just dismissed the normals when calculating the brightness of each vertex. Is there a way I can set this, so that no matter where the light is, the normal of the vertex is treated as if it is facing the light completely? The result would be like if I just used the material color, but if I can do this with hardware lights, my code will be a lot more uniform.
So is there a way I can set it so a light calculates based only on vertex position, and not normal? I still want the vertex position to be evaluated, so that it will work with spotlights.
07-21-2006, 09:42 AM
Emissive and ambient settings of the material don't depend on normals.
Spotlights only affect ambient, diffuse and specular, so ambient will be the one you want.
You need to set a white ambient light color as well for this.
Check OpenGL 2.0 spec formulas in chapter 2.14.1. for more details.
Or write a vertex shader which does whatever lighting you want.
If I were only using point and directional lights, there would be no problem. However, spotlights have a cone that the vertex has to be inside in order to light it. If I increase the ambient color of a spotlight, then undesired vertices outside the spotlight cone will be lit.
I can probably just do a math test for spotlights and completely light any model that is partially lit by a spotlight, since this is only for plants and transparent objects. I was just wondering if there was a way to deactivate the normal part of the lighting equation.
07-24-2006, 01:32 AM
If I increase the ambient color of a spotlight, then undesired vertices outside the spotlight cone will be lit.I don't think so.
If you look at formula 2.5 in chapter 2.14 of the OpenGL 2.0 spec, there is a factor spot_i which is zero outside the spotlight cone and is multiplied by the sum of ambient, diffuse and specular terms, which includes a_cm * a_cli (ambient color material * ambient color light_i).
Means, if you set your light model's ambient scene color to zero, the ambient color of the material should only affect the vertices inside the spotlight.
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.