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

Since this set of shaders is written in OSL, they can be loaded in every renderer that supports it. For installation procedures, go to your renderer of choices’ documentation.


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.


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.

  • 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 doing this calculation for each ray is just too expensive compared to a simple 2D kernel blur.
  • 4. Use the directional_scatter OSL shader to scatter bitmaps.
frequency=120 frequency=200 frequency=40
magnitude=0 magnitude=40
min_magnitude=5 min_magnitude=0
min_value=0 min_value=1