Archived

This topic is now archived and is closed to further replies.

McZ

How to find the closest light?

Recommended Posts

if I''m going to render an object with lights on.. how do I find the closest lights? should I have them inside my SceneGraph nodes along with the objects? my SceneGraph tree isn''t finished yet.. only on some kind of planning stage at the moment. I just want to know if it is a good idea to store the lights inside the nodes of the tree where they fit and then when I need some lights for a mesh then I call some GetNearestLights(...) with a parameter of a center point of my mesh or something else that could define what the light should be close to. or should I just have all my lights in a std::list or some other linked list and then just loop through that list and get a pointer to all lights that are close to my mesh. and then how do I define close/near? should I have some kind of sphere around the light that defines how far from it it should infect an object?

Share this post


Link to post
Share on other sites
Compute Light contribution (see OpenGL Red or Blue book, or the net to find the equations) at the ''central'' point of your Mesh/Object (most probably the center of your bounding volume, should it have a center, or put light into object space and use 0,0,0).

Sort by decreasing contribution.

-* So many things to do, so little time to spend. *-

Share this post


Link to post
Share on other sites