Sign in to follow this  
dietepiet

Light Object interaction

Recommended Posts

dietepiet    157
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

Share this post


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

Share this post


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

Share this post


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

Share this post


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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this