300 likes | 431 Views
Thoughts on Soft Shadows and the Visibility Problem. By Warren Hunt. The Goal. At the highest level, my goal is to develop a “better” algorithm to compute soft shadows in a ray tracer. The brute force method is too slow.
E N D
Thoughts on Soft Shadows and the Visibility Problem By Warren Hunt
The Goal • At the highest level, my goal is to develop a “better” algorithm to compute soft shadows in a ray tracer. • The brute force method is too slow. • Varying approximations have been proposed, with varying degrees of success. • It’s fair to say that the topic is still wide open.
Overview • My approach • Convex Bounding Volumes • Surface hierarchies • Current/future work
My approach to soft shadows • As opposed to attempting an approximation, I propose to improve the performance of the brute force method via cleaver data structures and algorithms. • Divide and conquer • Partial evaluation • Computational Geometry
Initial Idea • Use hierarchical bounding volumes and following insights: • If no objects cast shadows on a given bounding volume, then they also do not cast shadows on it’s children. • If an object casts a shadow over an entire bounding volume, then it also casts a shadow over the entirety of all of it’s children.
Continued… • Evaluation of visibility should be done lazily and the results of the computations should be cached at the volume hierarchy level. • Use convex hulls between two volumes to “batch” rays. The idea is to perform visibility checks between objects, not between points. If no objects intersect the convex hull, then no objects cast shadows.
The visibility algorithm • Given a point, can it see this light? • Start at the highest level of the bounding volume hierarchy that contains this point and work down. • If a bounding volume is completely visible to the light, at the next step down, the only possible occluder is the sibling. • If a bounding volume is completely in shadow, so is this point.
Continued and notes • To test if O blocks L from A, simply produce the convex hull of A and L and ask if it intersects O. If not, no shadows are cast, if it completely occludes A from L, then complete shadows are cast, otherwise, partial shadows are cast. • The algorithm for determining polygonal or spherical volume visibility can reduce to point visibility. (Degenerate spheres or polygonal volumes are points.)
Checkpoint • My approach • Convex Bounding Volumes • Surface hierarchies • Current/future work
Choosing a bounding volume • Bounding Spheres – poor bounds but very fast, and easy to compute • OBBs – much better bound, a little harder to compute, but good approximations exist • Convex Hulls – “Optimal” bounds, a bit harder to compute, approximations don’t work well. Not as expensive as originally thought.
The quickhull algorithm for point clouds • Produce a simplex and associate each left over point with a face they can see. All points inside the simplex are removed from further calculation. • Repeatedly: • Take a face with points associated with it. Replace that face with the volume containing it and the farthest point associated with it. • Re-associate the previous points with the new faces
Internal Volumes • A bounding volume is a volume s.t. For all points in this object, they are in this volume. • It is also useful to have volumes s.t. For all points in this volume, they are in this object. • These can be simple figures that can easily produce regions that are guaranteed to be in shadow. • Computing these volumes isn’t well studied
The IMPORTANCE of Convexity • All convex faces are divisions of geometry. • I will provide a demonstration of a neat ray-test optimization given convex geometry. • If the vertices of a convex object are linked, there is a very simple algorithm to see if a polygon lies on one side of a plane. • OBBs are a constant factor approximation of a convex volume.
Checkpoint • My approach • Convex Bounding Volumes • Surface hierarchies • Current/future work
Hierarchy • Multiple bounding volume hierarchies are necessary within a scene. Optimizations can be performed at the mesh level that cannot be performed at the object level. • I will spend the rest of this talk discussing bounding volume hierarchies at the mesh level.
Patching • Traditionally, BVHs over meshes are done by merging vertices or merging faces. The merging faces approach seems to work. • Here is an example of a face-merged hierarchy.
Quiz: • Given a point on this object and this light, how many intersection tests must be performed in order to determine if it is in shadow?
The IMPORTANCE of Convexity – revisited • Because each face of a convex object is a division of geometry. A convex object cannot cast shadows on itself. Given a point light source, testing if a the light is on the proper side of the face is enough to determine it’s visibility by that face. • Concave objects need only test their visibility across their rim.
Breaking up a complex object • Given an object, it would be nice to break it into convex and concave regions, here’s my algorithm. • Mark each vertex as concave or convex (easy test). • All faces that have only convex or concave vertices may be merged to ones they are adjacent to with the same property. • A face with mixed vertices may be added to either. • Some cleanup is needed.
Recap • My approach • Convex Bounding Volumes • Surface hierarchies • Current/future work
Current Work • Trying to implement any/all of this in PBRT and test/measure it. • Come up with efficient ways to create and store the BVH. • Determine the “best” BVH. (currently sphere/OBB hybrid)
Future Work • Come up with an algorithm to construct internal bounding volumes. • Come up with a simple test to see if a BV completely overlaps a CH in order to determine complete shadows. • Automated construction of the BVH at all levels. • Optimization!
Thank you for listening! • Any questions?