PDA

View Full Version : Light radius



blabla
07-07-2001, 04:10 AM
howdy.

i have a simple question about lighting.
i want a light source to a have a radius and beyond that radius polygons
wont be lit by that light source.

peace.

DFrey
07-07-2001, 04:39 AM
There are two ways you could do this (I'm assuming you are talking about vertex lighting by the way). You can tweak the attenuation parameters but that may not completely remove the light, or it may make the lighting overall too dark. The other approach is, you test each point with each visible light source and if the distance is greater than the light's radius, ignore that light. That will produce a sharp cutoff for the light. Otherwise, OpenGL itself isn't capable of doing that as is.

Cardinal
07-07-2001, 09:45 PM
as you get farther from the lightsource, you could scale your normals from 1 to 0. at 0 they shouldn't produce light anymore (although the calculations probably still take place, so you would want to disable lighting at that point). Just make sure GL_NORMALIZE is turned off.