For the past three decades, there have been two main schools of thought dominating the center stage of 3D graphics: rasterization and ray tracing.
Since the early days, Imagination has been firmly planted in the former by championing a unique rendering concept called TBDR (Tile-Based Deferred Rendering) that ultimately led to widespread adoption of GPUs in mobile and embedded devices.
However, little over a year ago PowerVR Wizard was announced – a game changer that promised to deliver real-time, power-efficient ray tracing. I’d like to use this article to explain what (PowerVR) ray tracing is, why is it still relevant today and where it could be used.
What is ray tracing?
If you really don’t care about the finer details and you want a five-second explanation of ray tracing, then all you need to know is that ray tracing will turn something like this:
Do I have your attention*? Good.
Since the 1990s, we have seen an exponential increase in rasterized GPU performance. However, each advance in visual quality has made content generation more complicated and costly. Every single effect (each shadow, reflection, highlight, or subtle change in illumination) must be anticipated by the designer or game engine, and special-cased.
This work often results in massive game title budgets, slower time to market, and ultimately less content on the platform.
Ray tracing takes a different approach to rasterized rendering by closely modeling the physics of light; it provides the only way to achieve photorealism for interactive content at an affordable price. Even though you might not have heard of ray tracing before, there’s a high probability you’ve already seen what it can do: ray tracing is the primary technique used for special effects rendering in movies. In addition, the techniques to produce realistic-looking games also use ray tracing offline in a process called pre-baking.
Finally, ray tracing has been used to seamlessly blend captured real life with computer-generated images (i.e. VR/AR applications) as it is much better at simulating optical effects like reflection and refraction, scattering, and dispersion phenomena compared to traditional rendering methods like scanline.
How does PowerVR Ray Tracing work?
The main reason why ray tracing hasn’t been fully embraced at a larger scale is that traditionally any real-time ray tracing application needed a GPU beast running an OpenCL-based algorithm to produce images similar to the one above. Since most people don’t have a water-cooled rig of 300W GPUs lying around their living room, ray tracing never really took off in a big way (if anyone from Pixar is reading, what I really meant to say was that Cars is a really good movie!).
The problem with using GPU compute for ray tracing is its inefficiency in handling the complex issue of keeping track of coherency between rays. You see, GPU compute is extremely good at data parallel operations that obey a certain (and predictable) structure. Image processing is a perfect application for GPU compute: you apply the same filter over and over again on every pixel in a rinse and repeat fashion.
PowerVR Wizard abandons this flawed computation-intensive approach and implements a much better solution that is modeled after how ray tracing actually works.
PowerVR Ray Tracing GPUs start with a pixel. For each step, the engine tracks intersections of a ray with a set of relevant primitives of the scene and performs geometry processing using a shader, exactly as in rasterization. Behind the scenes, the RTU (ray tracing unit) assembles the triangles into a searchable database representing the 3D world.
When a shader is run for each pixel, rays are cast into the 3D world. This is when the RTU steps in again to search the database to determine which triangle is the closest intersection with the ray. If a ray intersects a triangle, the shader can contribute color into the pixel, or cast additional rays; these secondary rays can in turn cause the execution of additional shaders.
All of this Wizardry (sic!) is implemented directly in hardware which makes the whole GPU very fast at handling specialized ray tracing tasks and conserves a lot of power, making it 100x more energy efficient than competing solutions; you can read more about PowerVR GR6500 (the first ray tracing GPU we’ve released) here.
The PowerVR GR6500 ray tracing GPU
Why is PowerVR Ray Tracing useful?
This is the vital and main advantage of using an RTU alongside a traditional GPU for ray tracing. By using specialized hardware to keep track of secondary rays and their coherency, an impressive speedup of the complicated computational process is achieved – this results in a higher degree of visual realism provided in real time.
A vivid example of PowerVR Ray Tracing’s potential can be found in a recent technical demo produced by Imagination in collaboration with Unity.
Using an experimental version of the Unity game engine, the team of developers implemented a hybrid rendering approach where certain elements in the scene (shadows on the pavement, reflections and refractions on metallic surfaces, etc.) are rendered using ray tracing while others (buildings, trees, pavements, etc.) are generated using traditional rasterized methods.
Even though rasterized content today already looks pretty impressive, there are still big challenges to close the gap between the photorealism that ray tracing offers and what we see on current-generation mobile and desktop devices.
Ultimately, the PowerVR Wizard family is aiming for real-time ray tracing that scales from tablets to desktop PCs and consoles – a future that is not too far away.
If you want to read my previous articles on ray tracing, here is a selection of useful resources to get you started:
- A blog article about the PowerVR GR6500 ray tracing GPU (PowerVR GR6500: ray tracing is the future… and the future is now) and an in-depth article detailing how ray tracing works (Ray tracing: the future is now)
- A featured post on Gamasutra describing practical techniques for ray tracing in games (Practical techniques for ray tracing in games)
- A guide on how we’ve implemented hybrid rendering in an experimental version of the Unity game engine (Implementing hybrid ray tracing in a rasterized game engine)
- A short preview of the PowerVR Ray Tracing-enabled Unity lightmap editor (PowerVR Ray Tracing behind the lightmaps in the Unity editor)
- The story of how we taped out our PowerVR GR6500 ray tracing GPU in a test chip (Award-winning PowerVR GR6500 ray tracing GPU tapes out)
* If I don’t have your attention, I promise that reading the text above will have saved at least one unicorn – and perhaps several rainforests!