# When Will Ray Tracing Replace Rasterization?

## Ray Tracing Myths

Ray tracing is not the ultimate solution though, and it's time to tear down the myths that surround it.

First of all, many gamers think that ray tracing is intrinsically a better algorithm than rasterization because "it's what the movies use." That's false. The majority of films using synthesized images (and all of Pixar's) use an algorithm called REYES that's based on rasterization. Pixar added ray tracing to RenderMan, its rendering engine, only later for the production of *Cars*. But even for *Cars, *ray tracing was used sparingly to avoid excessive computing overhead. Until then, Pixar used an external module for its limited use of ray tracing, such as for ambient occlusion (AO) effects.

The second widespread myth among defenders of ray tracing has to do with the complexity of the scenes that can be rendered with ray tracing and with rasterization. To get a handle on this, we need to take a closer look at each algorithm.

Here's how rasterization works for each triangle of the scene:

- the set of pixels that the triangle covers is determined
- for each pixel covered, its depth is compared with that of the nearest pixel

The main rasterization loop is based on the number of triangles. The algorithm has a complexity of O(n), where n is the number of triangles. The algorithm thus operates in linear fashion as a function of the number of triangles, since for each frame, the list of triangles has to be processed, one after the other.

Conversely, ray tracing operates as follows:

For each pixel of the frame:

- a ray is cast to determine which triangles are the closest
- for each triangle, the distance is calculated from the triangle to the image plane

As you can see, the loop is inverted, in a sense. In the first case, we take each polygon and look for which pixels it covers, and in the other, we take each pixel and then see which polygon it corresponds to. So, you might think that ray tracing is less dependent on the number of triangles than rasterization, since the number of triangles doesn't affect the main loop. But in practice that isn't so. In fact, to determine which triangle will be intersected by our ray, we also have to process all the triangles in the scene. Here again, partisans of ray tracing say that, in practice, it's not necessary to process all the triangles in the scene with each ray. Using the appropriate type of data structure, they say it's very easy to organize the triangles in such a way that only a small percentage of them need to be tested for each ray, concluding that ray tracing therefore has a complexity of O(log n) where n is the number of polygons.

And in fact, they're quite right. But these pundits are being a little dishonest in that that's also true of rasterization. Game engines have been using binary space partitioning (BSP) trees and other techniques for years to limit the number of polygons that need to be processed for each frame calculated. Another debatable point about this line of reasoning is that the data structure is particularly effective for static data. All that's needed is to calculate data once, and then simply access the data, which produces very good results. But what about dynamic data? There, the data structure has to be recalculated for each image, and to do that, there's no miracle formula. Each polygon has to be examined.

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.

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.

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.

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.

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.

Heh... this article brought to you by Nvidia.

will make raytracing possible.

(Together with a huge number of processing cores per graphic card and an advanced raytracing algorithm.)

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.

if nvidia wants to survive it must adapt and evolve. It's silly trying to persuade people about how bad raytracing is just because you're a dinosaur and don't want to acquire new know-how. Nevertheless even if nvidia is not willing to do it, there are already others who are filling the gaps.

Yep we will see real time ray trasing in games in something like 20 years? (Douple the speed of computer in each year) It takes something like 15 years to calculate one frame in 0.6 second (for movie company computers) and 4-5 year more to make it 24 frames per second... If the mores law keep on kicking. For home you can expect speed like that in 5 more years? lets say 10. So summa summarum we have high guality tray trasing games 30 years from now!

Well ofcourse Pixar has much higher need for guality, so less is needed for gaming.

In any way nice article! And in real life some sort of tray trasing can be seen sooner, but photorealistic computing is still far far away... pity I will be in pension or dead before I see it...

Great job Fredi, and tho some will deny what its going to take to get RT RT, you painted it as well as Ive seen. As for more in depth,if the article was too finely explained, the overall picture may have been lost, as seen by some comments.

I cant find the link I posted awhile back in the forums about Lexus? having a full time raytracer for their designing, but its still slow, and requires over 320 cores which are designed for this kind of work, not just a simple x86 cpu, so yea, we are aways off before anything real happens.

Once again, excellent article

Rasterization is still the better method. Besides, a decade ago, Doom3 proved you could do dynamic shadows in rasterization, which skeptics thought was too costly to perform (or downright impossible). Reflections will eventually follow.

Add on top of that the processing power needed to reach such levels at this time is just not economically smart. In time when average people can afford a system capable of rendering such games then it would make sense but only to the point in which our senses can actually distinguish whats on the screen.

Think of Film Noir and the very effective use of darkness an shadows. What you don't see contrasts what you do.

Remember the brighter the light source the DARKER the shadow.

If you are in bright sunlight (Fallout3) the shadows casts by objects and characters should be BLACK to you. This is because your iris is closed because of the sunlight. IT seem that something so simple is hard to pull off with rasterized rendering.