10
$\begingroup$

the voronoi texture node with the cells setting can make some really interesting textures, but the edges where the cells are joined to eachother are so unnaturally sharp, it just doesn't look good, is there any way i could potentially "soften" these edges? for example, replace the edges with a fade. or just distort the edges using a noise texture somehow? i have tried a few different things, but nothing has yielded the result i wanted.

If you have any ideas as to how to achieve a "softening" effect on the edges, please advice.

and thanks in advance.

Edit: those 2 methods i described are ways i think could potentially work, but i'm interested in any way that could soften or distort the edges of the voronoi cells.

$\endgroup$
2
  • 1
    $\begingroup$ Is this what you are looking for? blender.stackexchange.com/questions/9394/… $\endgroup$ Commented Jun 21, 2019 at 15:03
  • $\begingroup$ yes, kind of, but i'm gonna leave this thread open, cause im kinda curious if there are other ways to do it then as described in the link. $\endgroup$ Commented Jun 21, 2019 at 15:12

4 Answers 4

3
$\begingroup$

Since 2.83 you can achieve a blurred voronoi directly by setting the voronoi feature to 'Smooth F1'.
enter image description here

$\endgroup$
12
+500
$\begingroup$

It depends on what you mean when you say 'fade'. If you're looking to blend adjacent cells together then I think the only option would be as in the linked answer from Duarte's comment (How to blur a texture node in cycles material?). However, if you're looking to fade out one cell before fading in anther cell and you're using Blender version 2.8, then the new 'Crackle' option (which effetively gives you the distance to the 'edge') can effectively be used as follows :

faded edges of voronoi cells

The 'Crackle' mode of the Intensity Voronoi produces an output that is 0.0 at the 'edge' of the cells and increases (towards 1.0) with distance from the edge. By subtracting it from 1.0 we reverse the direction and increasing the Power node gives a 'sharper' falloff.

An alternative is to exclude the Subtract and flip the inputs of the Mix node - and lower powers will now produce a sharper falloff.

without subtract node

For more detailed control you could simply use a Color Ramp :

fade edges using a colorramp


EDIT: At Blender 2.80 the Voronoi node also gives you the Intensity and Cell color of the nearest 4 cells to that point in the texture. By combining the distances to the nearest 4 cells we can generate mix factors to allow us to mix between the difference colors of those cells and this allows a proper 'edge fade between colored cells'.

Here's the overall material :

material for edge blend

Note the 8 Voronoi Texture nodes - all set to the same Scale, with one set generating the Colors of the 4 cells (closest, 2nd closest, 3rd closest, 4th closest) and the other set of 4 generating the Intensities.

The intensities are passed into a node group to calculate the relative mix factors from those intensities - to mix the respective cell color - and the mixing is handled by the other node group.

For the mixing, the Colors are combined using the following maths :

# Mix 4 colors based on the values of 4 factors

_color1 = Color1
_color2 = Color2
_color3 = Color3
_color4 = Color4

_fac1 = Factor1
_fac2 = Factor2
_fac3 = Factor3
_fac4 = Factor4

_factorSum = _fac1 + _fac2 + _fac3 + _fac4

Output = vdiv(vadd(vmult(_color1, _fac1), vadd(vmult(_color2, _fac2), vadd(vmult(_color3, _fac3),vmult(_color4, _fac4)))), _factorSum)

Note that I've used an add-on (Node Expressions) to convert the textual expression into maths nodes within the group (but I've included the Blend file so you can see the generated nodes for your own use if you don't have that add-on). This works by using Vector Multiply (vmult) to multiply each of the Colors by the associated Factor and then dividing by the sum of the factors. At its core this produces the following nodes :

mix4 core nodes

ie, Multiply each color/factor, Add them together, Divide by the sum.

The cell distances are converted into mix factors using the following maths :

# Convert 4 cell distances into mix factors

#Define the inputs to the group
_dist1 = Distance1
_dist2 = Distance2
_dist3 = Distance3
_dist4 = Distance4

# Sharpness will control how 'sharp' the edges are. Avoid low values to avoid artifacts due to dense arrangements of cells (eg, where 5th Closest would have a significant influence at that range)
_falloffPower = Sharpness{3} * 10

#Factor of the 'current' cell will be constant
Factor1 = 1

#For the other cells, factor in based on how close it is compared to the 'current' cell - so that it is '1' at the boundary of the cell (so we get a smooth transition between cells)
Factor2 = (_dist1 / (_dist1 + _dist2)*2)**_falloffPower
Factor3 = (_dist1 / (_dist1 + _dist3)*2)**_falloffPower
Factor4 = (_dist1 / (_dist1 + _dist4)*2)**_falloffPower

Here the contribution of the 'current' cell is 1.0 and the adjacent cells are mixed in based on the distance to the 'edge' of the cell (using a similar calculation to that used to generate the standard 'crackle' output). The calculation is chosen such that at the edge of cells the contribution is always '1.0' - ie, the same as the 'current' cell. This ensures that when transitioning between cells (so the 'current' cells becomes '2nd Closest', for example) the contribution is the same, avoiding any 'hard' cutoffs in the blending between cells. The higher the 'falloff power', the quicker the contribution of the adjacent cells drops down to zero - resulting in a sharper edge.

Providing the Sharpness is high enough (so that the '5th closest', '6th closest' cells, etc. don't offer a significant contibution to the 'blend)) then this will produce a smooth transition between adjacent cells. This can produce the following result :

blender colors of voronoi

Note that one advantage using this method rather than using a Noise texture and multiple samples, is that since it's produced mathematically direct from the cells, it can be used for Bump mapping and Displacement. This means you can directly use it for 'tiles' or 'paving' or surface displacement to produce something like the following :

voronoi displacement

Blend file included

$\endgroup$
8
  • 1
    $\begingroup$ nice! Can you explain the values for subtract and Power? $\endgroup$
    – user1853
    Commented Jun 24, 2019 at 0:35
  • 1
    $\begingroup$ @cegaton No worries - added some explanation and alternatives to controlling the edge. $\endgroup$ Commented Jun 24, 2019 at 6:25
  • 3
    $\begingroup$ Thanks for taking the time to explain. $\endgroup$
    – user1853
    Commented Jun 24, 2019 at 6:29
  • 1
    $\begingroup$ Thanks for the bounty @cegaton. I've updated the answer with details of a further method of blending the edges of the cells. This is limited to Blender 2.8+ (since it uses the new extended Voronoi modes) but can be used for Bump and Displacement. $\endgroup$ Commented Jul 9, 2019 at 6:54
  • 1
    $\begingroup$ So the Sharpness is the variable and the '3' in brackets following it just indicates to the add-on what the 'default' value of that variable is - so in the example above, the _falloffPower will actually default to 3 x 10 = 30 anyway :-) $\endgroup$ Commented Aug 29, 2019 at 14:45
6
+125
$\begingroup$

If you're curious, in Blender Internal it's achieved with feature weights 2,3 and 4 increased by the same amount.

enter image description here

$\endgroup$
6
$\begingroup$

You could use a setup like this to add a bluring effect.

enter image description here

In the substract node, the second colour is pure white.

In the Add node, changing the factor in small increments will give a lot of blur.

No blur: enter image description here

Blur with the factor at 0.1 in the Add node: enter image description here

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .