A game of shadows: ray traced shadows vs. cascaded shadow maps

Share on linkedin
Share on twitter
Share on facebook
Share on reddit
Share on digg
Share on email

In an article published earlier this week, I described how developers can implement fast, ray traced soft shadows in a game engine running on our PowerVR Wizard architecture.

Today I’d like to present some very exciting results which demonstrate how ray tracing delivers significant reductions in memory bandwidth and power consumption over traditional rasterized methods (i.e. cascaded shadow maps).

Complete results: cascaded shadow maps vs. ray traced shadows

The images below compare an implementation of four slice cascaded shadow maps at 2K resolution versus ray traced shadows. In the ray traced case, we retain the shadow definition and accuracy where the distance between the shadow casting object and the shadow receiver is small; by contrast, cascaded shadow maps often overblur, ruining shadow detail.

Clicking on the full resolution images reveals the severe loss of image quality that occurs in cascaded shadow maps.

PowerVR Ray Tracing - cascaded vs ray traced-3

PowerVR Ray Tracing - cascaded vs ray traced-1

PowerVR Ray Tracing - cascaded vs ray traced-2

In the second and third examples, we’ve removed the textures so we can highlight the shadowing.

Optimizing the ray tracing algorithms

The diagram below describes the initial implementation of the ray tracing hybrid model described in this article.

PowerVR Ray Tracing - rendering pipeline-1f

The first optimization we can make is to cast fewer rays. We can use the information provided by dot (N, L) to establish if a surface is back facing a ray. If the dot (N, L) result is less or equal to 0, we don’t need to cast any rays because we can assume the pixel is shadowed by virtue of facing away from the light.

PowerVR Ray Tracing - rendering pipeline-2f

Looking at the rendering pipeline, there are further optimizations we can make. The diagram below shows the standard deferred rendering approach; this approach involves many read and write operations and costs bandwidth (and therefore power).

The first optimization we’ve made is to reduce the amount of data in each buffer by using data types that don’t have any more bits than the bare minimum needed; for example, we can pack our distance density buffer into only 8 bits by normalizing the distance value between 0 and 1 since it doesn’t require very high precision. The next step is to collapse passes; if we use the framebuffer fetch extension, we can collapse the ray tracing and G-Buffer into one pass, saving all of the bandwidth of reading the gBuffer from the ray emission pass.

PowerVR Ray Tracing - rendering pipeline-3f

Memory bandwidth usage analysis

Before we look at the final numbers, let’s spend some time looking at memory traffic. Bandwidth is the amount of data that is accessed from external memory; memory traffic consumes bandwidth. Every time a developer codes a texture fetch, the shading cluster (USC) in a PowerVR Rogue GPU will look for it inside the cache memory; if the texture is not stored locally in cache, the USC will access DRAM memory to get the value. For every access to external memory, the chip will incur significant latency and the device will consume more power. When optimizing a mobile application, the goal of a developer is to always minimize the accesses to memory.

PowerVR Ray Tracing - bandwidth

By using specialized instruments to look at bandwidth usage, we can compare cascaded shadow maps with ray traced soft shadows on a PowerVR Wizard GPU. In total, the cascaded shadow maps implementation consumes about 233 MB of memory while the same scene rendered with ray traced soft shadows requires only 164 MB. For ray tracing, there is an initial one-time setup cost of 61 MB due to the acceleration structure that must be built for the scene.

This structure can be reused from frame to frame, so it isn’t part of the totals for a single frame. We’ve also measured the G-Buffer independently to see how much of our total cost results from this pass.

PowerVR Ray Tracing - efficiency analysis

Therefore, by subtracting the G-Buffer value from the total memory traffic value, shadowing using cascaded maps requires 136 MB while ray tracing is only 67 MB, a 50% reduction in memory traffic.

PowerVR Ray Tracing - efficiency analysis-2

We notice similar effects in other views of the scene depending on how many rays we are able to reject, how much filtering we have to perform. Overall, we get an average of 50% reduction in memory traffic using ray traced shadows.

PowerVR Ray Tracing - efficiency analysis-3

Looking at total cycle counts, the picture is even better; we see an impressive speed boost from the ray traced shadows. Because the different rendering passes are pipelined in both apps (i.e. the ray traced shadows app and the cascaded shadow maps app) we are unable to separate how many clocks are used for which pass. This is because portions of the GPU are busy executing work for multiple passes at the same time.

Using ray tracing to implement soft shadows leads to a 50% speedup on a PowerVR Wizard GPU

However, the switch to ray traced shadows resulted in a doubling of the performance for the entire frame!

We hope you’ve enjoyed our two articles about ray tracing and PowerVR Wizard GPUs; we look forward to sharing some exciting news and real-world demonstrations in the near future – stay tuned to our blog and social media accounts for more details coming soon!

Additional resources on PowerVR Ray Tracing

For those interested in finding out more information on our PowerVR Ray Tracing technology, here is a selection of available resources from our archives:

Make sure you follow us on Twitter (@ImaginationTech, @PowerVRInsider, @PowerVR_RT) to get the latest news and announcements for the PowerVR ecosystem.

A big thank you to Justin DeCell for his huge contribution on developing the analytical soft shadows technique and for his help in making this happen.

Alex Voica

Alex Voica

Before deciding to pursue his dream of working in technology marketing, Alexandru held various engineering roles at leading semiconductor companies in Europe. His background also includes research in computer graphics and VR at the School of Advanced Studies Sant'Anna in Pisa. You can follow him on Twitter @alexvoica.

2 thoughts on “A game of shadows: ray traced shadows vs. cascaded shadow maps”

  1. Have you considered doing HSVA raytracing instead of RGB raytracing?
    Hue – Saturation – Vibrance – Alpha
    Think about it.
    What are people doing now. Shadowmaps = Low-res Raytrace Vibrance mapping
    Bounce Tone lights = Raytrace Hue bounce.
    Think about it. All of the RGB maps are over-computing the math required to quickly render a decent scene map. As white-spectral light hits an object, it gets Hue-subtracted and vibrancy subtracted. Eventually, all the rays get subtracted to zero, but the bonus is that this is massively faster than RGB since the rays hit zero far faster and are easier to compute in terms of statistical point clouds.
    The Alpha variable is useful for subtraction computing to null out glass shines and mirror reflections which over-complicate raytracing in general on object surfaces, but if you don’t care & want to save memory, you can drop it at a loss of speed-saving.
    The other bonus of HSVA render maps are that you can also tie points to light sources and dynamically adjust lights, color, saturation for the entire scene or just specific objects which makes fine-tuning end-render views as easy as moving a slider on objects.

    • the platform is fully compatible with general purpose graphics shaders and thus you can attach any colour representation you want to the rays. The concept of RGB colour representation is not intrinsic to the platform and is entirely flexible and under the creative control of the programmer.


Please leave a comment below

Comment policy: We love comments and appreciate the time that readers spend to share ideas and give feedback. However, all comments are manually moderated and those deemed to be spam or solely promotional will be deleted. We respect your privacy and will not publish your personal details.

Blog Contact

If you have any enquiries regarding any of our blog posts, please contact:

United Kingdom

[email protected]
Tel: +44 (0)1923 260 511

Search by Tag

Search by Author

Related blog articles

b series imgic technology hero banner

PowerVR SDK and Tools 21.1 Out Now – including ray tracing simulator

The sun is starting to come out, people are returning to society, and potentially most exciting; we at DevTech are releasing a new version of the PowerVR SDK and Tools. The PowerVR SDK contains not only our graphics development framework, but also a handful of example applications that show you not only how to implement certain techniques, but also make the most out of your PowerVR platforms. Between the modules that help you deploy cross-platform or libraries that let you focus on the actual code rather than boilerplate setup; our SDK has everything you need to hit the ground running with making a high-performance application. We’re starting with the SDK, rather than the tools this time, because this first talking point is a pretty big one, we think. 

Read More »
Beaglebone Black

Fun with PowerVR and the BeagleBone Black: Low-Cost Development Made Easy

Development boards are cool and the BeagleBone® Black (BBB) is one of the more interesting ones around. This widely available tiny board costs around £35 and will boot Linux is only 10 seconds so anyone interested in development can get stuck in quickly. The Introduction to Mobile Graphics course has been recently revamped for 2020 for the Imagination’s University Programme and the widely available, low-cost BBB is an ideal platform for student teaching and exercises based on OpenGL® ES2.0, instead of an expensive standard PC.

Read More »
ray tracing Detail Lighting

Imagination collects 5G Cloud Gaming Industry Alliance award for ray tracing

Imagination pioneered hardware-based ray tracing technology several years ago with a focus on an ideal blend of performance, quality power efficiency and the IP is available for licensing. Its efforts have been recognised by the 5G Cloud Gaming Industry Alliance (5GCGA), a new cross-industry collective that aims to develop the 5G cloud game industry worldwide.

Read More »


Sign up to receive the latest news and product updates from Imagination straight to your inbox.