Directional scattering relative to the geometry.

Directional Scattering
Random Scattering

Comparison of directional scattering with random scattering. For certain materials, this directionality is extremely important.

MOTIVATION

When creating shaders, sometimes random scattering of textures works like a charm and feels very natural. Other times however, there’s a strong directional bias to how the surface features are scattered on an object. A good example is for example a clay shader. Our hands move in very specific ways across the surface in order to shape the sculpture.

The ability to do this procedurally has been on my “this is missing in our shading toolkit” list for a while.

DOWNLOAD

I guess I don’t really need to justify 5$. The shader package is available for purchase through Gumroad.

WORKFLOW

Due to the quantization (sampling positions other than the current shading point) used in this shader, we need to bake out some maps in the process. This of course means the model will need usable UV’s.

Shader workflow

 

  1. Create a float map indicating where you want the strokes to have a directional aspect. In this example, it is a curvature map. Bake out the curvature map.
  2. Use the image_gradient OSL shader to calculate the image gradient (rate of change) and bake that out.
  3. Blur the baked out gradients to smooth out the vector field. I tried doing that within the shader but it’s just too slow compared to a simple 2D kernel blur.
  4. Use the directional_scatter OSL shader to scatter bitmaps.

PARAMETERS

Frequency=40
Frequency=200
Frequency=120
Magnitude=0.0
Magnitude=40.0
Minimum Magnitude=0.0
Minimum Magnitude=5.0
Minimum Value=0.0
Minimum Magnitude=1.0

Powered by themekiller.com