How does Smooth F1 Voronoi work mathematically?

[Not Solved]

I’m told that Smooth F1 Voronoi uses Smooth Minimum to visually smooth out the Voronoi Edges.
But how does it do that? I know the math behind Smooth Minimum and F1 Worley Noise, but how does Smooth Minimum selectively choose the Voronoi Edges as sharp corners to be smoothed out instead of the top or bottom of the displaced Voronoi Diagram?


(F1 Worley Noise)


(F1 Worley Noise with separate Minimum node applied)


(F1 Worley Noise with separate Smooth Minimum node applied)


(Smooth F1 Worley Noise)

You can see that the separate Minimum function slices the top of the displaced Voronoi Diagram, but to make that slice looks more organic, we can use Smooth Minimum (smin) instead of Minimum (min).
smin literally does the same job as min, it also visually smooth out the sharp corners generated by min.

So, Smooth F1 Voronoi is different to the combination F1 Voronoi + Smooth Minimum. Please help me understand what the math behind Smooth F1 Voronoi is. Also, what is “Smoothness” input? Is it the same as parameter “Distance” of Smooth Minimum?
Thank you!

You can find the code for one of the implementations of it over at

1 Like

Thank you. I’m a math student, I don’t know how to read codes so I’m asking someone to help me understand how it works mathematically.

Read the code, who knows what you may find, especially around line 48

3 Likes

Hi. I’ve thoroughly read the Smooth Minimum PDF, unfortunately, it doesn’t explain nor derive the maths behind the Smooth F1 Voronoi, doesn’t explain how Smooth F1 Voronoi manages to selectively choose the Voronoi Edges as sharp corners to be smoothed out. The PDF introduces the intuition behind Santos’ and Quilez’s Smooth Minimum which I’ve already studied and derived before.

Pre-scriptum:

  • Did I understand correctly that you’ve enrolled in a math course? Congrats!
  • How I wish this markdown supported simple LaTeX expressions!

I’m not sure I understand your question but as far as I can see the relevant math is indeed all contained (well… mentioned, not explained) in the linked PDF.

It seems you’re under the impression that there should be a node M representing a “smooth minimum” function such that, if you plugged M after a regular F1 Voronoi node, it’d output the same as a F1 smooth Voronoi node. But there’s no such M (It’s not technically impossible, but M would have to be made aware of the position of every feature point in the Voronoi texture.).

The basic idea of a Voronoi texture is that you distribute a bunch of “feature dots” on the plane and then, for any point on the plane, the value of the texture there will be the distance to the nearest feature dot. That’s where the minimum function comes in: if I wanted to know the value of the texture on a given point p, I’d find the distance from p to all the distributed “feature dots”,
{distance to dot_1, distance_to_dot_2, ... }
and then take the minimum value from that set of distances:
Voronoi(p) = min(distance_to_dot_1, distance_to_dot_2, ...).

It’s this “minimum function” used above that the PDF wants to replace with a “smoother” substitute.

After you’ve evaluated the Voronoi texture, all the node returns is the final value for each point: the distance from there to the nearest feature dot. Any node you plug in afterwards can only have access to this information. In particular, the node would have no way of knowing the individual distances {distance_to_dot_1, distance_to_dot_2, ...}, and so it wouldn’t be able to simulate the behaviour of the “smooth Voronoi”
smooth_min(distance_to_dot_1, distance_to_dot_2, ...),
that does have access to each individual distance.

Does that help?

2 Likes

Hey champ, welcome back! Great to see you.
Yes I’m in a 2 months long math course but it’s not doing very well at teaching me the necessary math to understand Blender. So here I am teaching myself maths again.


I’m not sure I understand your question

Ok, so in simple words, I need to understand the math (or the intuition) behind Blender’s Smooth F1 Worley Noise. For example, if I want to understand the Sine function node, then I need to understand what Trigonometry is and what f(x) = sin(x) is. But, studying Sine is way easier than studying such niche stuff like Smooth F1 Worley Noise because the studying resources are so scarce.

If you know Smooth Minimum, you’ll know that there will be discontinuous sharp corners generated by min function when two shapes (second image in my post: a horizontal plane (x,y,3) and Voronoi Diagram) are unified. That’s when smin function comes into action, it visually smooth out those sharp corners (third image in my post). So smoothing out the sharp corners of the union of a (x,y,3) plane and a Voronoi Diagram is understandable, but what about the union of the Voronoi Edges and Voronoi Diagram? How does Blender detect and register those Voronoi Edges as sharp corners to smooth them out? (forth image in my post)

The PDF unfortunately doesn’t explain how Smooth F1 Worley Noise works but instead introduce the intuition behind Smooth Minimum and Voronoi, which doesn’t help. The PDF is supposed to explain how Smooth F1 Worley Noise work.


The best information regarding Smooth F1 Voronoi that I’ve collected (from Reddit) so far is:

  • In original F1 Worley Noise, to identify which Feature Point (Voronoi Seed) in the Coordinate System that a point (pixel) belongs to, we calculate all the distances between that sample point and all the existing Feature Points, then the outputted value of that sample point would be the minimum of those calculated distances: min(d₁,d₂,d₃,…).
    In Smooth F1 Worley Noise, we use smin(d₁,d₂,d₃,…) instead.

This method seems easy enough, I can derive both Voronoi Diagram and Smooth Minimum so there shouldn’t be any problem. But the question raised is, does Blender even use this method?
Now is the moment that I need programmers to check the codes to see if the method is valid. Please help me with this if you can.


It seems you’re under the impression that there should be a node M

Yes that was my naive view of this situation lol.


That’s where the minimum function comes in: if I wanted to know the value of the texture on a given point p , I’d find the distance from p to all the distributed “feature dots”,
{distance to dot_1, distance_to_dot_2, ... }

Oh whoops, I read this part after writing the “smin(d₁,d₂,d₃,…)” part above. Thank you, but could you please confirm that this indeed is how Blender works by observing the code? If it really is, then my doubts will be clearly immediately and this post comes to a conclusion.

Hi!
I’ve been asking around on Reddit for the past day and someone told me that the Blender’s Smooth F1 Voronoi’s intuition uses Smooth Minimum (as you suggested), but its implemented code uses SmoothStep Interpolation, is that true? Theoretically, should the intuition produce the same thing as what the code implemented?

The code isnt’t very hard to understand, you can likely answer your own question by looking at line 289

1 Like