I know how to animate a procedural texture to make it translate, rotate and scale on an object, but is it possible to animate a procedural texture to radiate from the center of a sphere? Think of something like carbonated bubbles radiating out of a blob of water in space, going in all directions. How would I achieve that effect?
1 Answer
In order to have the procedural texture radiate from the centre you need to base in on the direction and the distance from the centre - you can then animate an offset on the distance in order to animate the 'blobs' moving in the desired direction from the centre.
Using Object coordinates, a direction vector can easily be obtained by using the Vector Maths Normalize node. This will produce a vector of length 1.0 in the direction of that point in the texture, in relation to the origin (0.0, 0.0, 0.0).
Similarly, for the distance you can use the Vector Maths Dot Product node - by feeding the Object coordinate into both inputs the Dot Product will produce the square of the distance. A Power maths node set to 0.5 will take the square root, producing the distance from the origin.
We can now generate the procedural texture from the Vector (X,Y,Z) and Distance (D).
In order to demonstrate this, we can use a trick used in How to animate musgrave texture? to create a texture that has more than three 'input' dimensions. This allows us to use X,Y,Z as the input Vector and D as one of the other inputs.
The node group uses vector maths to combine a pair of Noise textures to produce a noise-like output that is based on the 6 input values (X,Y,Z,T1,T2,Seed).
This new node group can be used as follows :
Note that the Add node can be varied to animate the texture so that the pattern moves outwards from the centre. This can produce the following result :
EDIT : Since we have a 'spare' input of the Noise5D texture group we can use a similar technique to that described in How to set musgrave to get something periodic? to make the texture repeat - to make the animation cyclic. For this we take D (the distance from the centre, adjusted to add an offset for the animation) and convert it into circular coordinates - to feed into T1 and T2 instead of just T1. This makes the pattern repeat after a specified distance (as set by the Value node feeding into the Divide maths node). By adjusting the scale of the circular coordinates (the Value node feeding to the Multiply nodes) we can adjust the scale of the pattern before it repeats.
Note the Multiply node set to 2*pi
(6.283) to set a whole rotation (for the cyclic repeat). This allows the Value feeding to the Divide to set the period of repeat on the input coordinate (as animated by the Value node feeding to the Add node for the offset.
Animating the 'offset' with linear interpolation over the set range can now produce the following cyclic result :
-
3$\begingroup$ Awesome! Exactly what I was looking for. Thank you very much! $\endgroup$ Commented Oct 2, 2018 at 3:58