Russian Roulette sampling
In this post we’ll have a look at some sampling technics that can dramatically speed up your render times without affecting image quality. Let’s explore the alSurface shader for Arnold, and the “magic” Russian Roulette check-box.
alSurface
The alSurface is a general-purpose shader (similar to the default aiStandard) from thealShaders library, that can create any material type (apart from hair and skin that have their own shader). It has two specular layers, so you can easily create layered reflections with no effort, and it ensures energie conservation.
So basically it has either a diffuse or a refractive/transmissive layer in the base and then you can add one or two specular layers on top ( a common roughness map in the first specular layer and a clear coat on top for instance).
This should cover most of the materials you will need, but you can always combine two alSurface with the alLayer node, or even with a more complex network with a layered texture and an aiUtility to receive the shading result.
Sample splitting
So diffuse, specular, refraction, IOR, we all know that from the aiStandard, and it works the same in the alSurface. So why would we use it instead of the “official” general-purpose Arnold shader?
Apart from the two specular layers, this shader has some optimizations that can dramatically decrease render times, specifically the Russian Roulette sampling, but how does it work?
Let’s look at an example, rendering glass. In a “normal” approach the render engine willcalculate at each intersection a unique ray for refraction and other for reflection, and “filter” the result using the index of refraction.
With Russian Roulette there is a random function in between that will either calculate the refraction or the reflection ray, according to the Fresnel function.
But if we’re using some “hacks” in between, what does it means in terms of image qualityagainst the “real thing”?
So, as you can see there is almost no difference between the aiStandard and the alSurface renders. In other hand, there is a big difference in render time, the alSurface is way faster for a given ray depth (10 in this example).
The render times are based on a 960×540 resolution with 5 AA samples, on a common desktop machine.
And if we populate the scene with some objects to reflect and refract we won’t notice much difference either, apart from the render times of course.
aiStandard | 17:44 min
alSurface | 05:18 min
How do we turn it on?? Russian Roulette is on by default when you’re using the alSurfaceshader, see the image below.
Path termination
So what else can this Russian Roulette thing do for us? In a typical interior scene we wouldneed many bounces to fill the scene with light, and some of those bounces, while they “travel” through the scene, become so dark that they won’t contribute much to the final result of the rendered image. So here the RR function will randomly choose to stop or continue to calculate those rays, which will result again in a very similar image but a dramatic speed increase.
For this scene I am using only an hdri light, wich has only a door and a window to let the light to fill the interior, which makes it really hard for a brute force engine like Arnold.
AA: 8 DIF: 6 DIF-DEPTH: 10 | aiStandard | 131:37 min
AA: 8 DIF: 6 DIF-DEPTH: 10 | alSurface | 59:13 min