[comp.graphics] Shadows and RayTracing

matt@genius.Berkeley.EDU (new user) (05/16/91)

Hello All,

    I've have implemented a ray tracer using the uniform spacial subdivsion
algorithim.  Tracing a picture is now acceptably fast on a 386.  However
when I try to do shadows the speed fall to the unacceptable level.  I use
the shadow ray algorthim i.e for each point cast a ray at each light source
and see if it strikes an object.  The addition of object caching to the code
help quite a bit but it is still to SLOW.
    Is anyone aware of a quicker way to generate shadows with ray casting?
It would be nice to be able to do soft shadows as well.
    I have a simple idea that should help some.  I have not tested it so don't
flame me to bad if it has obvious flaws.  On the cached polygon calculate the
distance to the nearest edge from the shadow ray intesection point.  Use this distance a radius.  On the next shadow ray, find the plane intersection point for the cached ploygon.  Calculate the point's distance from the old point and compare against the radius.  This avoids doing the point in a poly test for some  of the shadow rays.  I'm not sure the overhead is worth it though.
If the first ray is in the center of the polygon, I think it would be worth. 
    This idea can be extended to lines.  Save two hits in a polygon and make a ray out of them.  Calculate the distance along the ray to the nearest edge.  Now
if a third point is on the ray and within the calculated distance, it hits the
polygon.  This idea relies on the coherence of the shadow rays.  If they are
orderly this idea should save a lot of point in a polgon tests.
All comments welcome.  


Matthew E Fisher

My opinions are my own and not those of my employer.