3-D PSRDnoise tutorial

Page 1 2 3 4 5 6 7

3: Adding a dimension

Because we are using procedural texturing, all our mapping problems with this sphere can be solved by using a 3-D texture instead. The texture coordinates are now the local object coordinates.

Already in this very simple example, we are seeing one clear advantage of "psrdnoise", namely the pattern animation we can do with the "alpha" parameter. Using traditional noise implementations, animation of this 3-D texture would have required using 4-D noise with the fourth coordinate changing with time. 3-D noise is considerably cheaper to compute than 4-D noise, even counting the extra work spent on computing the rotations with "alpha".

This looks better as well. A 2-D slice through 4-D noise (the surface of this sphere is two-dimensional, even though it's curved) will always have problems with low frequency content being introduced by the mapping, and the pattern will look different from 2-D noise. A 2-D cut through 3-D noise, which we are using here, has some of that problem as well, but not nearly as severe.

We would argue that 3-D noise is not only faster to compute and better looking than 4-D noise, but also easier to understand, which is nice.

		// Fragment shader code goes here