For a turbulent fluid texture I'm working on, I need to distort texture coordinates in a repeated, step-wise fashion, so this seems like a job for OSL. Specifically, I need to offset each point in a texture by a small amount based on the value in a noisy color texture that represents a velocity field (r=vx, g=vy, b=vz=0).
In the illustration below, I've used small arrows to represent the velocity field rather than the RGB texture I'll actually use. Each blue dot represents a starting point to trace the velocity field. Each blue curve represents a path that is consistent with the local velocity field at each point along the way.
However, the examples I have found here and on other sites offset texture coordinates globally (the same offset or scale applied to the entire texture).
I'm looking for a method to distort texture coordinates non-uniformly in small repeated increments to follow the velocity field similar to the blue curves in the illustration above. I will use the resulting coordinate map to warp a simple color texture.
I can imagine this effect could be achieved with a Particle System and a Turbulence Force Field, but (1) I can't imagine how I would fill the entire surface with color without using an enormous number of overlapping particles and (2) I can't figure out how to constrain the particles to the surface of an arbitrary mesh.
I opted for OSL because I hoped to generate a distorted coordinate system for every point in the texture and let the renderer sample the texture appropriately.