solutions to homework #6 wu xiaomao may 27, 2004
TRANSCRIPT
Solutions to homework #6
Wu Xiaomao
May 27, 2004
15.5 Explain for the z-buffer, depth-sort,
Warnock, and BSP-tree algorithms, how piercing
Polygons would be handled. Are they a special
case that must be treated explicitly, or are they
accommodated by the basic algorithm?
Z-buffer:
In z-buffer algorithm, polygons get scan converted one after another, the z-buffer and fame buffer are updated when scan-converting each polygon with respected to its z value and color of each pixel. Piercing polygons can be handled by the usual algorithm.
Depth-sort
The depth-sort algorithm is a list-priority algorithm and does handle neither piercing nor overlapping polygons. It sorts the polygons by their farthest z value and draws the nearest polygon. When handling piercing polygons, we can just split the polygons into several polygons which do not pierce each other, which can be handled by the ordinary depth-sort algorithm.
Warnock Warnock’s algorithm will divide the area around t
he piecing polygons until the resolution of the display device is reached. Then it will use the depth-sort algorithm or z-buffer algorithm to determine which polygon is the nearest at the center of the pixel. So piercing polygons will be treated correctly in standard warnock algorithm, there are no special cases need to be handled.
BSP-tree The binary spare partitioning tree algorithm
belongs to list-priority algorithms. It handles piercing polygons in a straight way. The polygons just divide the space into two different spaces so that piercing polygons be cut into two new polygons that are handled accordingly.
15.19 When ray tracing is performed, it is typically necessary to compute only whether or not a ray intersects an extent, not what the actual points of intersection are. Complete the ray-sphere intersection equation using the quadratic formula, and show how it can be simplified to determine only whether or not the ray and sphere intersect.
Solution:
The original equation
can be written as:
if b2-4ac=0 one intersection point
else if b2-4ac>0 two intersection point
else if b2-4ac<0 don’t intersect
15.24 Implement a simple ray tracer for sphere and polygons, including adaptive supersampling(Choose one of the illumination models from Section 16.1) Improve your program’s performance through the use of spatial partitioning or hierarchies of bounding volumes.
Marco Kunze Martin Mehlitz
Sebastian Nowozin Timo Glaser