Rendering Translucent Object using OptiX

Introduction

This project is finished as the final project of the Computer Graphics course in 2018 Spring. At that time the latest NVIDIA® GeForce RTX GPU hasn’t been published yet. I then chose the OptiX framework to apply the Ray Tracing functions of GPU.

Translucent object can be hard to render. However, with the full use of GPU’s computing power, this task can be achieved in a simple and quick way. OptiX is a framework designed by NVIDIA used to easily get parallel calculation in ray tracing process. In our project, the render can even be done in real-time.

Theory

The light distribution in highly scattering media tends to become isotropic. This is true even if the initial light source distribution and the phase function are highly anisotropic.

A Practical Model for Subsurface Light Transport   Henrik Wann Jensen   Stephen R. Marschner

We can assume that after a light shooting into the surface, it will randomly go to all the direction. This is the same for the ray we tracing from the camera. Translucent objects have such kind of nature. We can simulate this process and as far as possible to reach the real effect.

The algorithm is simple. When a ray hit the surface of a translucent object, we first calculate the direct light emission of the hit point. Then from the hit point, shoot rays into the object in different direction. We call the new rays as a scatter ray. The rays are sampled uniformly in a hemisphere space. Find the insect point of the scatter ray, calculate the direct light emission of the insect point, add it to the result of the hit point multiplied by a decrease function. In the function there is a parameter set for different sizes and materials of the object.

Result

For the two blocks, we set the transparency of the them as a low value, so it looks like marble. For the dragon and bunny model, we set a higher transparency so the look like jade. For the princess model, we can see even under the cover of the skirt, the performance of legs is still acceptable. The performance of the skirt is also proved that the algorithm is robust for narrow, thin and detailed object.

The time used for rendering is also short. Under GTX960M 4G, Intel Core i5 2.3GHz, the dragon and princess used about 30 seconds and the bunny uses only less than 20s. All the images shoot 256 rays per pixel and 15 scatter rays per hit point. If we shoot about 4 rays per pixel we can get a real-time rendering result with a DPS around 10.

Code & Project Accessment

The whole project can be found in my github repo.

The core code for the scattering process is shown below.