Path: utzoo!attcan!uunet!cs.utexas.edu!asuvax!enuxha!hollasch From: hollasch@enuxha.eas.asu.edu (Steve Hollasch) Newsgroups: comp.graphics Subject: Arbitrarily-Shaped Light Sources Keywords: ray trace light graphics algorithm Message-ID: <1438@enuxha.eas.asu.edu> Date: 16 Sep 90 22:33:01 GMT Organization: Arizona State University Lines: 47 How do raytracers make light sources out of arbitrary objects? I thought a while back that one approach would be to find the direction to the object from the illuminated point, fire a random cone of rays at the object, and assign some fraction of the object's light to the point for each unobstructed ray. The main drawback of this approach, as I see it, is that it would yield a mottled illuminated area, and the mottling would vary in a random manner. About five minutes ago I had an idea for another approach: - Find the 2D bounding box (from the illuminated point's view) of the illuminating object. - From this box, get the two orthogonal basis vectors. - Now subdivide this bounding box (using the basis vectors), just as you would the original raytrace grid. - For each light ray fired, determine if the ray intersects the illuminating object. If it does, increment the `silhouette' counter. If the light ray intersects no other object, then increment the `light' counter. - Once done, the light that shines on the illuminated point is (light_counter/silhouette_counter) * object_light. This technique would also lend itself to numerous optimizations. For example, if you assume that all light objects cast a convex silhouette, then you could use binary search techniques to locate the edges of the silhouette. That is, you can assume that all scan lines will be runs of space-silhouette-space intersections, hone in on the edges, and then multiply the resulting silhoette width by the scanline height to get the relative area. Is there a better way to do this? I haven't come across this problem in any of the graphics texts I've read. ______________________________________________________________________________ Steve Hollasch Arizona State University @ Tempe, Arizona hollasch@enuxha.eas.asu.edu | uunet!mimsy!oddjob!noao!asuvax!enuxha!hollasch -- ______________________________________________________________________________ Steve Hollasch Arizona State University @ Tempe, Arizona hollasch@enuxha.eas.asu.edu | uunet!mimsy!oddjob!noao!asuvax!enuxha!hollasch