Discover the new KeyShot

Design for
tomorrow.
Market today.

Discover the new KeyShot

Design for
tomorrow.
Market today.

Rendering Caustics in KeyShot on the GPU

Categories

Date

June 2, 2021

Share This Story

Written By Henrik Wann Jensen
Dr. Henrik Wann Jensen (M.Sc., Ph.D) is the Chief Scientist at Luxion, makers of KeyShot, and Professor Emeritus at the Computer Science Department at the University of California, San Diego. His research is focused on realistic image synthesis, global illumination, rendering of natural phenomena, and appearance modelling. His contributions to computer graphics include the photon mapping algorithm for global illumination, and the first technique for efficiently simulating subsurface scattering in translucent materials. He is the author of "Realistic Image Synthesis using Photon Mapping," AK Peters 2001. He is the recipient of an Academy Award (Technical Achievement Award) from the Academy of Motion Picture Arts and Sciences for pioneering research in rendering translucent materials.

An analysis of what sets caustic apart in KeyShot and the advantages gained by advancements in GPU technology.

Caustics are among the most beautiful lighting phenomena in nature. Caustics are formed as light refracts through or reflects off specular surfaces. Examples include the light focusing through a glass of cognac, the shimmering light at the bottom of a swimming pool, and even the beams of light from windows into a dusty environment.

Caustics History

I have been fascinated by caustics for a long time. My career in computer graphics got started after attending a keynote by Peter Shirley (at the time a visiting professor at Cornell University), who said we do not know how to render caustics except in simple scenes such as caustics on a diffuse plane. I was a student at the time and I had been working on an algorithm called photon mapping for fun that did exactly what he was talking about. I did not think it would be useful at the time, but his keynote made me think otherwise, and I started publishing papers with a focus on rendering caustics [1]. My caustics scene of choice at the time was a glass of cognac as shown in figure 1. A few years later I worked with Per Christensen at mental images, and we extended photon mapping to render volume caustics as shown in figure 2.

01a-keyshot-caustics
Figure 1: Caustics are formed as light is focused through a glass of cognac. This is an early research image from 1995.
02a-keyshot-caustics
Figure 2: Caustics in a medium caused by light focusing through a glass sphere. Research image from 1999.

Photon mapping works by tracing photons from the light sources into the scene and storing these photons as they interact with the surfaces or volumes in the scene. The second step is rendering the scene using a ray tracing (or path tracing) algorithm that uses the photons to compute caustics and other lighting elements. The original photon mapping algorithm can render beautiful caustics and global illumination, but it is limited to the number of photons that can be used to render a given scene. I worked together with my PhD student at UC San Diego, Toshiya Hachisuka, to overcome this limitation and it led to the development of progressive photon mapping [2].

03-keyshot-caustics
04-keyshot-caustics
05-keyshot-caustics

Figure 3: A reflective cube on a diffuse plane. Left image shows the scene without caustics, the middle image shows the scene with a simple screen space method for caustics, and the right image shows the full lighting solution that includes both the caustics and the reflection of the caustics in the cube.

Progressive photon mapping is the first algorithm capable of rendering global illumination and caustics in general scenes. To illustrate this figure 3 shows a simple reflective cube on a diffuse plane illuminated by a point light source. If this cube is rendered using path tracing it completely lacks the caustics due to light reflected off the cube onto the diffuse plane. More advanced algorithms such as bidirectional path tracing, metropolis light transport can render the caustics on the diffuse plane, but none of these methods can render the reflection in the cube of this caustics (what is known as a specular-diffuse-specular interaction). Several current “physically based renderers” can only render the caustics shown in the middle image and lack the ability to render the reflection of caustics. Progressive photon mapping renders everything including the reflection as shown in the right image in figure 3. The progressive photon mapping algorithm is illustrated in figure 4.

keyshot-caustics-gpu-06

Figure 4: Progressive photon mapping is the first algorithm capable of rendering global illumination in complex scenes. It works by combining multiple passes, where each pass consists of emitting photons from the light source into the scene and rendering an image leveraging the photon map.

KeyShot has been using progressive photon mapping since its inception, and KeyShot has been able to render caustics with a single click since the first release. KeyShot is using a newer development of adaptive progressive photon mapping [3] to compute both caustics on complex indirect illumination. This algorithm is quite complex and it requires complex data structures to keep track of the photons and it runs only on the CPU.

Caustics on the GPU

Fast forward to 2018 I was attending the NVIDIA keynote where CEO Jensen Huang introduced the new RTX hardware ray tracing technology. He also showed an interactive demonstration of the new hardware that included caustics. After the keynote I spoke with Jacopo Pantaleoni (a research scientist at NVIDIA), who told me that he had to implement the caustics for the demonstration as Jensen Huang had explicitly asked for it. Jacopo had implemented a variation of photon mapping that used a screen based reconstruction kernel to avoid having to build a complex data structure.

The interactive path tracing and caustics demonstrations at SIGGRAPH 2018 was an eye opening experience and after discussing the RTX technology with several researchers at NVIDIA and hearing their talks it became clear we needed this technology in KeyShot. The challenge was how to get the complex algorithms in KeyShot mapped to the GPU? Jacopo’s algorithm worked well, but it could not handle the reflections of the caustics as shown in figure 3. In KeyShot 9, we ended up implemented a full progressive photon mapping algorithm on the GPU capable of rendering caustics including the reflections. The GPU photon mapping algorithm renders the same image as the CPU version, but it was not quite as sophisticated. In most cases the raw power of the RTX GPUs compensated for this and made full rendering of caustics on the GPU possibly and still pretty fast. However, we had to tell some of our customers that for complex caustics they might be better off using the CPU as it would still be faster due to the advanced algorithms used.

Blazingly fast caustics on the GPU

KeyShot 9 was the first version of KeyShot that took full advantage of the GPU. The RTX technology coupled with the mature CUDA programming framework made it possible to get everything ray tracing, photon mapping, shading etc. running on the GPU. As we were developing KeyShot 10 we took a deeper look at the GPU implementation and decided to see if we could improve the photon map implementation and obtain faster caustics. This required quite a few cups of coffee (thanks Rocket espresso), but in the end we were able to not only match the CPU algorithm but also surpass it. The end result is a caustics algorithm that can handle thousands of lights, quickly render highly detailed caustics up close, and runs blazingly fast on the new NVIDIA RTX Ampere GPUs.

 

06-keyshot-caustics
07-keyshot-caustics

Figure 5: Caustics from an environment and a point light through a glass of cognac. The detailed structure in the caustic is due to the tessellation of the cognac glass. Both the image on the left and the close-up on the right are screenshots taken after 10 seconds of real-time rendering.

“However, the new caustics algorithm in KeyShot 10.2 renders this detail in just 10 seconds for both the distant view and the close-up view.”

Using the new caustics algorithm in KeyShot 10 we started getting details and fine structures in the caustics that normally would not be seen due to the time it takes to get to this detail level. Figure 5 shows a close-up of the caustics from the cognac glass in figure 1. Notice, the structure in the caustics caused by the fact that the cognac glass is made of triangles and not a continuous smooth surface. Normally, this is not seen as this level of detail would require a long rendering time. However, the new caustics algorithm in KeyShot 10.2 renders this detail in just 10 seconds for both the distant view and the close-up view.

 

09-keyshot-caustics
10-keyshot-caustics

Figure 6: Caustics from perfume bottles: a model by Will Gibbons with caustics from a bathroom environment (left), and a model by Brad Adelmann showing caustics from a studio environment.

11-keyshot-causticsFigure 7: Caustics including volumetric caustics due to light refracted and reflected by the glass sphere and the dichroic glass reflectors in this scene. Scene by Dries Vervoort.

Figure 6 shows caustics from perfume bottles courtesy of Will Gibbons and Brad Adelmann. Figure 7 shows complex volumetric caustics caused by refraction and reflection of both regular dielectrics and dichroic glass causing a spectral separation of the beams. Figure 8 shows a glass of orange juice without caustics and with the caustics formed by light focusing through the glass into the orange juice. Notice, how the orange juice gets much brighter while still showing the caustics pattern formed as light refracts through the glass surface. All images rendered on the GPU and they can all be manipulated interactively in KeyShot 10 and the caustics updates with any changes made to the scene.

12-keyshot-caustics
13-keyshot-caustics

Figure 8: A glass of orange juice without caustics (left) and the same glass with caustics including volume caustics in the juice liquid (right).

“KeyShot 10 pushes the boundaries of what I thought was possible with caustics in a render engine,” relates David Merz, Founder & Chief Creative at Vyzdom. “I used to avoid caustics completely in my work due to long render times and problematic noise and fireflies, which is unfortunate because these beautiful refractions and reflections are a vital visual-cue in our real-world and are important for achieving photorealism. With the latest updates, I’m creating more impressive work without sacrificing valuable time. Having the ability to have unparalleled caustics with the click of button is a breath of fresh air.” He continues, saying that “caustics in KeyShot 10 have turbo-charged my workflow – especially since it works seamlessly on the NVIDIA RTX A6000 – the speed allows me to quickly make small iterations and not wait hours to see the results of my decisions. I get a perfectly clean representation in matter of minutes.”

2103-keyshot-10-caustics-david-merz-00
2103-keyshot-10-caustics-david-merz-01
2103-keyshot-10-caustics-david-merz-04

Figure 9: Various examples of KeyShot’s ability to accurately refract light through prisms of different sizes and shapes. Images: David Merz.

2103-keyshot-10-caustics-david-merz-05
Figure 10: Caustics visualized in KeyShot of light refracting through the bottom of  a whiskey tumbler. Image: David Merz

Conclusion

We believe the new RTX GPU-based caustics algorithm in KeyShot 10 is a game changer for anyone working with transparent or reflective products such as perfume, jewelry, lighting designers and more. We are confident this is the best algorithm available for rendering caustics on GPUs or CPUs and we look forward to seeing more beautifully rendered caustics in the wild.

References

1
keyshot-caustics-gpu-14
“Rendering Caustics on Non-Lambertian Surfaces”

Henrik Wann Jensen
Proceedings of Graphics Interface ’96, pages 116-121, Toronto, May 1996

2
15-keyshot-caustics

 

“Stochastic Progressive Photon Mapping”

Toshiya Hachisuka and Henrik Wann Jensen
ACM Transactions on Graphics (Proceedings of SIGGRAPH Asia 2009), Yokohama, December 2009

3
keyshot-caustics-gpu-16
“Robust Adaptive Photon Tracing using Photon Path Visibility”.

Toshiya Hachisuka and Henrik Wann Jensen
ACM Transactions on Graphics (Volume 30, Issue 5), 2011

 

 

Dr. Henrik Wann Jensen

Dr. Henrik Wann Jensen (M.Sc., Ph.D) is the Chief Scientist at Luxion, makers of KeyShot, and Professor Emeritus at the Computer Science Department at the University of California, San Diego. His research is focused on realistic image synthesis, global illumination, rendering of natural phenomena, and appearance modelling. His contributions to computer graphics include the photon mapping algorithm for global illumination, and the first technique for efficiently simulating subsurface scattering in translucent materials. He is the author of “Realistic Image Synthesis using Photon Mapping,” AK Peters 2001. He is the recipient of an Academy Award (Technical Achievement Award) from the Academy of Motion Picture Arts and Sciences for pioneering research in rendering translucent materials.

Related Posts

Making the Impossible Possible with KeyShot’s RealCloth

Making the Impossible Possible with KeyShot’s RealCloth

KeyShot Adds Support For Stratasys Full-Color, Multi-Material 3D Printers

KeyShot Adds Support For Stratasys Full-Color, Multi-Material 3D Printers