Gabor noise for Cycles OSL

Hidden in the the treasure trove that is OSL lies a spanking new noise type: Gabor noise. Surprisingly this not yet exposed as a node for artists to explore. This article remedies that situation.

And now for something completely different

Gabor noise is fairly new and has some interesting qualities. Apart from the mathematical properties the most important aspects for the artist are that it is easy to tinker with and offers a change from the ubiquitous Perlin noise.

The shader is almost to simple to show here:

shader gabor(
point Pos = P,
int anisotropic = 0,
vector direction = vector(1,0,0),
int do_filter = 1,
float bandwidth = 1.0,
float impulses = 16,
output float Noise = 0
Noise = noise("gabor",Pos,
"anisotropic", anisotropic,
"direction", direction,
"do_filter", do_filter,
"bandwidth", bandwidth,
"impulses", impulses);
It offers all the options documented in the OSL language specification and produces a single float value. This can of course be adapted easily to take for example 4 dimensions (position and time) as input and produce a 3D noise vector as OSLs noise() is very versatile but this is left as an excercise for the reader.

Example node setup

Suzanne was patterned with the following node setup:

Gabor noise is of course capable of much more: there is plenty of room to experiment. You might like to show some results on Blender Artists. Some examples are shown below:

Recently I reread a long running thread on Blender Artists and saw that phoneybone implemented a pure OSL version of Gabor noise that gives a bit more control than the built-in function. Do read on his solution because it is interesting to compare.

1 comment:

  1. You will notice that half of your object is black, even though your node setup doesn’t use any black.

    This is because the Gabor noise function in OSL outputs a float in the range [-1, 1]. I think Blender clamps negative factors to 0. So you are really losing half the range of the noise.