# How does the Sobol pattern work, and why can I sometime see spiral pattern?

I would like to have little information / science popularization about the sobol pattern, Monte-Carlo integration (or other pattern) for a curious 3D artist that use blender tool every day and haven't a good mathematical/programming background to understand hardcore math.

When I add a light with low radius, and plane for example, and add another plane with glass material. I can see a spiral pattern. It is only visible using the Sobol pattern. The number of branch of the pattern increase as there are more samples.

Example of Sobol pattern (increasing one sample per frame) :

Same with Correlated Multi-Jitter:

I also have tested to change material setting like metal (Here is metal from 0 to 1 always rendered at 50 samples) :

• Are you asking about the [blender.stackexchange.com/questions/47216/](Sobol pattern in the Cycles Rendering settings)? Or is it used somewhere else? Commented Oct 24, 2021 at 20:24
• Yes, I'm aware that cycle ray tracing use bidirectional path tracing, and use Monte Carlo pseudo random numbers to "converge" using a "low discrepancy sequences" like Sobol or Progressive Multi-Jittered. But I'd like more explanation or draws/video that show how this converging work, and why I get this sort of spirals in my particular case. Commented Oct 24, 2021 at 20:31
• It's interesting that there are some patterns in this question as well math.stackexchange.com/questions/888490/… Commented Oct 24, 2021 at 20:35
• Thanks for the link, but I find hard to understand math with Z (sum) equation, I would prefer something readable for non-tech artist. There is the 2min papers video about light path youtube.com/watch?v=1ziudxJT884&t=21s, but it has bad sound, and as English isn't my main language I prefer to get concise stack exchange answer (that are really often well written) A video of "First Principles of Computer Vision" YouTube channel would have been good, but he didn't have made one about ray-tracing yet. Commented Oct 24, 2021 at 20:39
• Soory for side-tracking but this made me think of youtube.com/watch?v=EK32jo7i5LQ Commented Oct 26, 2021 at 14:56

I think that the behavior that Blender is showing is a bug not a feature, as the whole point of using a Sobol pattern is to generate a uniform distribution of sample points in space. The result of your experiment should be different between Sobol and multi-jitter but no pattern should appear in either. That's the whole point of using sophisticated random sampling.

That said, I don't think there is an intuitive explanation of how the Sobol sequence works, in the sense of how it goes about meeting the requirements imposed on it; (converging to a low discrepancy sequence) but I think it's fairly easy to explain what it accomplishes in path tracing systems.

The motivation here is that by using random sampling, it is possible to reduce the number of paths that have to be sampled. This is done using Monte Carlo methods.

There's a fairly straightforward example of a Monte Carlo methods in the Wikipedia article: determining the value of π Here's a non-mathematical explanation of how to do it, ala Jackson Pollock.

# Mechanical Monte Carlo

Imagine a machine that randomly drops paint dots on a square piece of paper. Draw a circle on that paper. Now, as the machine drops paint, count the number of drops that fall inside the circle, and the number that fall outside. The Wikipedia article shows an animation of this for a quarter circle. In our case, $$A = drops_{in} / drops_{total}$$

The area of the circle will eventually be the area covered by drops inside the circle as a percentage of the total number of drops. (I simplify and ignore drop size, but that can be factored in.) We can work backwards from that area value to the value of π since we know that $$A = \pi * r^2$$ and since we drew the circle we know r and we've just estimated A using a Monte Carlo simulation, $$\pi = A / r^2$$

The other thing to notice is that we don't have to cover the entire square with paint. The more paint we drop, the closer we'll get to π but sooner or later we can say "good enough" and quit.

# The role of Sobol Sequences

The gotcha is in the first sentence of the description: "randomly drops paint dots". Imagine the machine is broken and all of its drops fall within a small distance from the center of the square. Your count will be wrong because the drops didn't fall randomly enough. You'll end up with a value of π calculated as 1, rather than 3.141...

This is where things like Sobol patterns come into play. For Monte Carlo methods to work properly, they need patterns that have the property of low discrepancy. So what does that mean intuitively.

Let's go back to our splatter pattern. Once the machine stops, draw a square anywhere on the paper and count the number of paint drops in the square. If the ratio of drops to size of square is very close to the same no matter where you draw the square. no matter the size of the square and no matter how many squares you draw, then the pattern is low discrepancy.

# Summary

To sum it up, if you can drop paint randomly in such a way that the coverage has the same density anywhere on the square, but the drops are deposited at random, then you have a pattern that can be used in a Monte Carlo simulation. A Monte Carlo simulation is good because we can approximate the right answer with fewer samples than necessary to get it absolutely right. Without explaining how the Sobol sequence generates such a pattern, we know from mathematics that it should.

In rendering, we approximate the full scene by using a Monte Carlo simulation to do such sampling, strictly as a performance versus result quality trade off.

• This was a very interesting read, nicely explained for us mere mortals, thanks :) Commented Dec 13, 2021 at 9:43
• You're welcome. When it comes to randomness, we're all mere mortals. ;) Commented Dec 13, 2021 at 15:48