# How to animate noise texture “seed”?

It's possible to animate a change noise texture by animating the texture coordinates with a mapping node or by animating the texture space, however this only works on one axis at a time (on the other axes the texture will appear to be sliding across the object's surface).

For example, the top face has the desired effect but the other faces appear to be moving/sliding upwards:

Even with all three axes location and rotation animated it still appears to be sliding rather than statically changing.

Is there some way to make each face appear like the top face in the first gif but still be seamlessly blended with the other faces? This should work for other shapes as well.

In other words, I'm looking for a way to animate the "seed" of the texture.

-

You can not animate the seed of a 3D gradient noise texture because it´s usually all fixed in a permutation table. What you are basically looking for are 4D gradient noise textures.

Why do 3D gradient noise textures not work? Imagine a 3D procedural texture as a continuous grid in space containing colour or intensity values at any node. Also imagine your mesh inside this grid. For simplicity imagine that every point on the surface of the mesh gets the colour of the nearest point of the grid assigned to it. Now imagine moving the grid or the manifold mesh. Eventually the points will move along the normal of a few faces but they can usually not move along the normals of all faces at a given time. And if they don´t move perfectly along a normal they will slide along the surface.

To overcome this limitation we need to add a dimension which we can then animate.

So how can we do this in blender/cycles?

We can program it ourselves in OSL(Open Shading Language). First we need the code for our 4D texture shader (e.g. a very simple one):

``````#include "stdosl.h"

float Scale = 1.0,
float Time = 0.0,
output color Color = 0.0
)
{
Color = noise( "uperlin", P * Scale, Time );
}
``````

Use the internal text editor and name the above text block e.g. noise.osl. We use the builtin noise function with 4D unsigned perlin noise. The 4th component named Time will be used to animate the texture. Scale is used to scale the texture as usual. The output is named Color. For more information see the OSL specification osl-languagespec.pdf.

Edit: By the way, there already exists a script template "Noise" in the text editor called noise.osl. I didn´t know this by the time I posted this answer. It provides some more 4D noise algorithms.

Important

On the render tab of the properties panel enable "Open Shading Language". The Open Shading Language checkbox will only be available with CPU render mode.

Then add a material to the object as usual and add a script node and set the shader script to "noise.osl". Click the "Update shader.." button next to the shader name input. Use the output colour e.g. as input colour for a Diffuse BSDF shader.

Now Time can be animated as usual.

For more complex noise just edit the OSL code accordingly.

-
Excellent answer! +1 for OSL exposure ;-) – Matt Apr 1 '14 at 21:11
@hawkenfox make sure you are using "Cycles Render" in the engine dropdown menu. – user2859 Jan 30 at 12:36
@ user2859 Was on "Cycles Render" but the problem was that I need to use CPU render mode and not GPU for OSL check box to be available. – hawkenfox Jan 30 at 16:42
@hawkenfox Oh, of course OSL only works on CPU for now. Thanks for the edit. – user2859 Jan 31 at 10:48

If using the objects UV's is not a firm requirement you can use the following setup to animate noise. Conceptually, this is like placing the object 'within' the 3D texture and then moving that texture. It's seamless across the faces. Using the i shortcut to set keyframes for Location, Rotation, and Scale is quick and works well.

EDIT:here's the animated .gif

-
Could you upload a gif of how this looks? The second gif in my answer is made by animating the location and rotation, but you can still tell the texture is sliding.. – gandalf3 Mar 29 '14 at 19:04
Unfortunately this seems to have the same problem as the second gif in my question, where the texture seems to "slide" across the surface of the object. – gandalf3 Apr 1 '14 at 20:10
yeah, I know. I did not understand your question properly. The other answer given is really nice. I didn't know that could be done. I almost deleted this answer but decided to leave it since several people seem to think it's also useful to them. I prefer the other solution as well. – MarcClintDion Apr 1 '14 at 20:32