Worley Cellular Voronoi Noise (Composition by gtoledo3)

Author: gtoledo3
License: MIT
Date: 2013.04.06
Compatibility: 10.5, 10.6, 10.7, 10.8
Required plugins:

This shader is something I've wanted to do for a long time; a gpu-accelerated voronoi type image filter.

This uses the concept I was thinking of here (http://kineme.net/forum/Programming/StencilbufferinQC#comment-25903) . As I was making it, I realized it would be interesting to also have a mode where the randomness of the grid was controlled by luminosity, so there are a couple of modes for that.

Parameters: -distFormula: This changes the distance formula used for the voronoi computation from linear to "manhattan".

-lightMode: This changes the shader from a flat look, to a simple gradient "lighting" look, to a more complex "lighting" look with adjustable normals, and finally a normal output of the complex look.

-displaceMode: This controls whether the grid noise is triggered by brightness, darkness, or it's a constant value.

-displaceAmt: This controls how much each cell is displaced. With the luminosity displace modes, it's a multiplier, with the constant mode, it's constant.

-density: This controls the density of the voronoi grid.

-uvOffset and Zoom: I've added this because of the nature of the worley algorithm, cells at the top and side can sometimes be right where the texture repeats. A little zoom in and recenter solves this.

-normAdj/normAdjA/B/C - This is only active with the last two lighting modes. This changes the shape of the voronoi facets.

Enjoy. Please give credit if you use it, and also note that it's MIT licensed. The sample composition uses GL Tools, because it renders to a Quad, but if you don't have it installed, just use a Billboard/Sprite/whatever.

gtoledo3's picture
Re: Worley Cellular Voronoi Noise (Composition by gtoledo3)

This is the "manhattan" distance calculation, versus the linear equation used above. Both use lighting mode 3, the pic above with tweaked normals via the "normAdjust" parameters.

mona_manhattan.png454.81 KB

Prack's picture
Re: Worley Cellular Voronoi Noise (Composition by gtoledo3)

wow. thanks, looks great!

jersmi's picture
Re: Worley Cellular Voronoi Noise (Composition by gtoledo3)

Very amazing, ~60fps (at least) on OSX 10.11.4, QC 4.6.1, mid-2014 MBP with NVIDIA GeForce GT 750M 2048 MB.