16.6. Vertex NoiseIn the previous chapter, we talked about some of the interesting and useful things that can be done with noise. Listing 16.3 shows a vertex shader by Philip Rideout that calls the built-in noise3 function in the vertex shader and uses it to modify the shape of the object over time. The result is that the object changes its shape irregularly. Listing 16.3. Vertex shader using noise to modify and animate an object's shape
The key to this shader is the call to noise3 with a value (Offset) that changes over time. The vertex itself is also used as input to the noise3 function so that the effect is repeatable. The ScaleIn and ScaleOut factors control the amplitude of the effect. The result of this computation is added to the incoming vertex position to compute a new vertex position. Because of this, the vertex shader must compute gl_Position by performing the transformation explicitly rather than by calling ftransform. |