Light Object interaction

Started by
3 comments, last by Gage64 15 years, 8 months ago
Hi all, To render a scene with lighting (not using deferred shading), one has to determine all light-object interactions. To me, this sounds like a collision/interaction detection problem. This can be solved using a prune-and-sweep or some multidimensional grid method. However, these methods are build for all-to-all collision detection. Does anyone use other methods, specialized for determining collisions between two disjoint groups of objects (lights vs objects)? thnx, Dietger
Advertisement
I have zero experience with this, but assuming that both the lights and the objects are stored in some sort of spatial tree structure, I would traverse the tree and build a list of all lights and objects whose bounding volume intersects the frustum. For each light, I would take all visible objects whose bounding volume intersects the light's bounding volume, and add the contribution from that light to those objects.

This doesn't take occlusion culling into account, and I'm not sure how to handle directional lights (how do you construct a bounding volume for such a light?) - maybe you can take their direction into account - but I think it's a good start.
Keep in mind that lighting in most cases doesn't have to be 100% accurate. You could use a technique like spherical harmonics or probes to get a good idea of the light in an area, and then have objects find the nearest (or perhaps strongest) N probes or lights and only use those to light the object. Combined with a decay based on distance (so you don't suddenly stop using a light probe because another one becomes closer all of a sudden, which would be visually jarring), it might work well enough. Of course, you will only find out if these approaches work for you by testing them out :)
Thanx for your fast reactions!

As you say Zipster, using only a limited number of lights is probably an acceptable approximation. The real problem however, selecting the closest/strongest lights for any object, stays. The problem is formulated within a RTS context, so one may see a number of relatively small lights scattered over the visible map, most objects only having 1 or 2 lights effecting them.

To Gage64, I agree that is probably the most straightforward approach. I was merely interested in how to implement the part where the object-light intersections are determined. I do not like the idea of brute force checking all visible lights and objects (Not scalable). I was triing to think of a data structure containing only visible lights and objects, which manages all light-object intersections in a fast and usable manner.

Quote:Original post by dietepiet
I was merely interested in how to implement the part where the object-light intersections are determined. I do not like the idea of brute force checking all visible lights and objects (Not scalable). I was triing to think of a data structure containing only visible lights and objects, which manages all light-object intersections in a fast and usable manner.


When you collect all visible objects, you can place them in a spatial data structure like a quadtree or octree. Then you can traverse that to find all objects that intersect the light's bounding volume.

This topic is closed to new replies.

Advertisement