Point lights

Started by
3 comments, last by O-san 16 years, 7 months ago
Hello! I want to render several OpenGL point lights, at least 4-5 lights per object. So I've thought out a system where I've got a list of all my lights and then another list for the real OpenGL lights. When I render an object I take into account which lights (the larger list) will have a large enough light radius to affect this object. When I know which lights affects the object (no more than eight) I copy the light properties to my smaller OpenGL light list and set up the lighting for that object. My problem is calculating the radius of the light… I know an OpenGL light have three components in which it lights a scene, ambient, diffuse and specular. The ambient factor, should I use it at all for the point lights? If I recall correctly; ambient will always affect the surrounding objects regardless of its distance from the light source. This will cause trouble to my point lights which should only light a restricted area, not the entire level because it has an ambient term. Is disregarding the ambient term (setting it to zero) the correct way to go about this? Thanks for reading! Help appreciated.
Advertisement
lighting intensity = ( constant_attenuation + linear_attenuation*distance + quadratic_attenuation*distance*distance ) ^ -1

... IIRC, that is. Can't find my bluebook ...
Thanks for the reply! As far as I know the ambient term is just a cheap knockoff for real global illumination. But I'll have a look at the attenuation factors again.
yes dont have any ambient term for point lights (only for directional ones)
also instead of using the standadrd gl method of attenuation

i recommend a linear falloff

L.w = ( end - dist ) / ( end-start );
Okay! Thanks... That cleared it up! :) The example I've read used a directional light, I just assumed to use it on my point lights also.

This topic is closed to new replies.

Advertisement