Jump to content
  • Advertisement
Sign in to follow this  
O-san

OpenGL Point lights

This topic is 4107 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement
lighting intensity = ( constant_attenuation + linear_attenuation*distance + quadratic_attenuation*distance*distance ) ^ -1

... IIRC, that is. Can't find my bluebook ...

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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 );

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!