yknow what? heck u *unscrambles your rays*

Originally posted on Cohost: 2024-07-03
a red dragon and eggbug in a cornell box, with and without ray scrambling. The with is a noisy image, and the without image does not have noise but all surfaces appear reflective and with projected images from other parts of the scene

If you've used a ray/path tracer you know that the output always starts out noisy - rays are very discrete things so you need to trace a lot of them if you want things like soft shadows, global illumination, depth of field and motion blur. The noise comes from the fact that scattered rays are sent towards different directions for each pixel.

But there's nothing stopping you from just, not doing that

In Blender this can be changed by reducing the Scrambling Distance multiplier found under Sampling → Advanced. The default value of 1.0 gives the expected random directions result with noise, but setting this to 0.0 makes rays scatter along the same direction (depending on the normal of the surface that is hit).

a gif showing individual render samples of the above scene with scrambling enabledOne sample per pixel, scrambled
a gif showing individual render samples of the above scene with scrambling disabledOne sample per pixel, no scrambling
a gif showing 30 samples accumulating with scrambling enabledAccumulated samples, with scrambling
a gif showing 30 samples accumulating with scrambling disabledAccumulated samples, no scrambling

With no scrambling, an image with just one sample taken per pixel can look very freaky, with surfaces appearing sort of perfectly reflective, with images of other parts of the scene "projected" onto them, because all the camera rays hitting that surface were all scattered towards the same direction.

The image at the start of the post shows the projection effect clearly, as only one sample was rendered per pixel in both the scrambled and non scrambled image. With no scrambling you will still get rays scattering in new directions for each new sample, so if you wait long enough you will get a clean result, it will just take a whole lot longer to converge as you can see in the gifs.

Another thing you can notice in the gifs is how the unscrambled dragon appears in different positions for each sample, and that's because of the depth of field effect that offsets rays a bit to simulate the way a camera aperture affects focus.

Similarly to depth of field, motion blur is also achieved by offsetting rays, but doing so in time instead of in space. Motion blur with no scrambling appears like several images taken at different points in time, like this image that was rendered with 8 samples per pixel in both the scrambled and unscrambled case:

a render of a train with motion blur, both with and without scrambling

Soft shadows and diffuse reflections are also like this, and with no scrambling they will appear as multiple completely sharp shadows and reflections, like this image with 4 samples per pixel:

a render of eggbug illuminated by a spotlight casting a soft shadow and diffuse reflections on the floor, appearing as sharp shadows and reflections in the unscrambled case

Volume scattering is ... also affected the same way, appearing as several distorted projections of the scene, like this example with 8 samples per pixel:

eggbug in a foggy scene lit by a light from the side. the unscrambled version appears like multiple eggbug images distorted and overlaid on top of each other