When Will Ray Tracing Replace Rasterization?

A Simple Algorithm?

The final myth is that of the natural simplicity and elegance of the ray tracing algorithm. In fact, while it is easy to write a ray tracer in a few lines of code (certain functional ray tracers can be written on the back of a business card), writing a high-performance ray tracer is another story.

David Luebke, an engineer at Nvidia, made the following remark, and it's totally in line with reality: "Rasterization is fast, but needs cleverness to support complex visual effects. Ray tracing supports complex visual effects, but needs cleverness to be fast."

The code for a minimal ray tracer was written by Paul Heckbert to fit on the back of a business card

All you need to do is read a few articles about the optimizations made to ray tracers to see how apt Luebke's remark really is. For example, the most powerful ray tracers don't handle rays independently, but instead use what's known as ray bundles, which optimize performance when the rays have the same origin and a similar direction. That kind of optimization is well suited for the single-instruction multiple-data (SIMD) units found on CPUs and GPUs, and so is very effective for primary rays that have a certain coherence or for shadow rays. But on the other hand, it's not at all suitable for refraction or reflection rays.

Further, as Daniel Pohl points out in his article on Quake Wars RT, using ray bundles can be problematic with transparent textures (the famous alpha textures used for trees), because if all the rays in a bundle don't have the same behavior (some touching the surface and others passing through it), an additional cost can quickly arise that's greater than the gains achieved by using ray bundles.

A visualization of the rendering cost of each pixel, with the red pixels being the most expensive. You can see that rendering the trees is particularly expensive in the ray-traced version of Quake Wars

Finally, as we mentioned, ray tracing requires the right data structure to store the different elements of the scene, and it will play a determining role in the resulting performance. But choosing and then managing that data structure is not easy. Some structures have better characteristics for static data, while others can be updated faster with dynamic data or take up less memory. As always, the key is finding an acceptable compromise. There's no miracle solution.

So as we've seen, ray tracing does not always serve as the model of simplicity and elegance that some make it out to be. Getting good performance with a ray tracer requires the use of just as much programming ingenuity as is used with rasterization to reproduce the most complex effects.

  • IzzyCraft
    Greed? You give an inch they take a mile? Very pessimistic conclusion although it helps drive the industry so hard to really complain. ;)
  • Ramar
    I'm definitely the kind of person that would prefer to lose some performance in exchange for elegance and perfection. The eye can tell when something is done cheaply in a render. I've made this argument that quite often we find computationally cheap methods of doing something in a game, and after time it seems to me that we've got a 400 horsepower muscle car that, on close inspection, is held together with duct tape and dreams. I'd much rather have a V6 sedan that's spotless and responds properly.

    Okay, well in real life, the Half Life 2 buggy would be a lot cooler to drive around than a Jetta, but you get the analogy.
  • stray_gator
    Great article!
  • zodiacfml
    i still like the simplicity of ray tracing and how close it is to physics/science. it is just how it works, bounce light to everything.

    there are a lot of diminishing returns i can see in the future, some are, how complex can rasterization can get? what is the diminishing returns for image resolution especially on the desktop/living room?
    ray tracing has a lot of room for optimization.

    for years to come, indeed, raster is good for what is possible in hardware. look further ahead,more than 5 years, we'll have hardware fast enough and efficient algorithm for ray tracing. not to mention the big cpu companies, amd & intel, who will push this and earn everyones money.
  • stray_gator
    aargh. start typing, then sign in to find your first words posted.
    Anyway, what I liked about this article is its being under the hood, but not related to a new product, announcement or such.
    "deep tech" articles accompanying product launches tend inevitably to follow the lines of press kits, PR slides, etc.
    Articles like this, while take longer to research, are exactly that - they are researched rather than detailing "company X implemented techniques Y and Z in their new product, which works this way, benefits performance that way and is really cool.". it gives an independent, comprehensive view of the subject, and gives the reader real understanding in the field.
  • enewmen
    The ray-tracing code on the business card was way cool. I was hoping (real-time)ray-tracing and photo-realistic rendering will come with DX11 and GPGPU offloading - this seems completely unrealistic.
    I still never read of any dedicated ray-tracing hardware, at any price. It seems the better we understand ray-tracing and it's limitations, the more cloudy the future becomes.
  • shurcooL
    Nice article. Seems to be fairly accurate.
    Ray tracing will inevtiably replace rasterization. It will just flat out look better to the human perception, when in motion, than pure rasterization, and that is all that is required.

    Heh... this article brought to you by Nvidia.
  • annymmo
    Hopefully GPGPU (OpenCL)
    will make raytracing possible.
    (Together with a huge number of processing cores per graphic card and an advanced raytracing algorithm.)
  • Inneandar
    nice article.
    I wouldn't mind having just a little bit more technical depth, but I'd be glad to seem more like this on Tom's.