Expand Voronoi node functionality in Cycles
Closed, ResolvedPublic


This minor functional patch expands the functionality of the Voronoi textture input node in Cycles on two fronts:

  • it adds a second output socket "F2" which provides the distance to the second nearest neighbour
  • it adds a drop down selection to the node with a choice of distance metrics.

Addition of the F2 node makes it possible for texture designers to obtain the F2 - F1 (aka Voronoi crackle) pattern by chaining it to a subtract node. The distance metrics added allow for a greater variety of patterns. I have implemented the Manhattan, Chebychev and Distance metrics (besides the default Distance squared)

Care has been taken to keep the node fully backward compatible with the existing Voronoi node: the default distance metric is "Distance Squared" an the old 'Fac' output socket is retained although it might have been slightly more logical to rename it to F1 but this would break existing noodles.

It is a deliberate choice to add an F2 socket and not a F2F1 socket as this opens up more possibilities for the end user (and reduces the computational overhead by a single subtract although adding a subtract node in a noodle might actually be more expensive). Also I have left out the Minkowsky metrics as there are less commonly used and would clutter the node interface with a bunch of extra parameters. We could always introduce that later if there would be a huge demand for it.

As indicated in the comments in svm_voronoi.h, there is some room for performance improvement in the code, both in the SSE2 branch and in the non SSE2 branch but this would further complicate the code for a small and uncertain gain.

The code is tested both on a GPU (a GTX970 but I actually used sm50 not sm52) and a CPU (intel core 7) both on existing textures with a voronoi node as well as with nodes with new functionality, but only on Ubuntu (15.04)

  • diff -------------------------


Michel Anders (varkenvarken) updated the task description. (Show Details)
Michel Anders (varkenvarken) raised the priority of this task from to Needs Triage.
Michel Anders (varkenvarken) set Type to Patch.
Julian Eisel (Severin) triaged this task as Incomplete priority.Aug 14 2015, 5:44 PM

@Michel Anders (varkenvarken), thanks for the patch. Could you upload it to our differential review tool?

@Julian S (julian) Eisel: sure, it's on https://developer.blender.org/differential/diff/4860/

I referenced this task in the comments but did nt assign reviewers (I am not sure I am supposed to do that anyway, so I hope someone is interested :-)

Julian Eisel (Severin) closed this task as Resolved.Aug 14 2015, 8:22 PM
Julian Eisel (Severin) claimed this task.

Thanks, added reviewers. It doesn't seem like we need a diff and a patch task for this, so closing task.