Monday, September 25, 2006

Ray Tracing vs. Raster Graphics

The rendering technique—ray tracing has reached the stage where it is feasible that it will take over from raster graphics in the near future for interactive simulation/gaming and other application domains. Ray tracing is the act of tracing the trajectory of a ray from one point to another to determine if anything is hit and the distance to the nearest hit point. In fact, ray-tracing techniques can achieve the exact same results as raster-based techniques (including all the approximations and tricks that raster solutions typically require); however, it does not work the other way round.


The primary differentiating factor between raster- and ray tracing approaches is that a ray tracing approach enables one to solve a global problem, while a raster-based approach seeks to achieve similar results by solving a local problem.

Raster graphics attempts to render an image efficiently by making certain convenient assumptions. In particular, it treats triangles as if each triangle is entirely independent of every other triangle. There is a concept of the current state and the current triangle. This is the Graphics Processing Unit's (GPU) view of the entire world; it has no idea if or what comes next. In general, due to the way that raster systems work, they process every pixel of every submitted triangle to determine the final image that needs to be displayed. So raster graphics performance scales strongly with the number of triangles and pixels that have to be processed for a given image, so cost scales strongly linearly with viewport size and overall scene complexity.

Because ray tracing takes a global approach, the natural interface to it is different that that used with raster graphics. Recall that raster graphics use an “immediate mode” interface, and is only aware of a current state and a current primitive at any point in time. Ray tracing, on the other hand, needs a “retained mode” interface where random access to the whole scene is required, and when a visible triangle is determined, a specific shader needs to be invoked on demand. However, the really exciting news is how the ray tracing workload scales. It is strongly effected by the number of rays shot in a scene and weakly effected by the complexity of the scene! Ray tracing scales linearly with the number of rays shot and only logarithmically with the complexity of the scene. For a fixed resolution image, the cost of raster graphics doubles (roughly) as the complexity of the scene doubles; for ray tracing, you would have to increase the viewed scene complexity by 10 times to double the cost. Here we emphasize viewed scene for the ray tracing is not so much overall scene complexity dependent, but dependent upon the visible complexity of the scene. Another amazing fact of ray tracing is that its performance scales linearly with the number of CPUs ( with today's raster oriented graphics accelerators ). And measured linear performance scales up to 128 CPUs (3.2GHz Pentium 4).




0 Comments:

Post a Comment

<< Home