One thing that makes me happy about modern GPUs is just how darned fast they are. I find that I can create procedural textures with multiple calls to my noise function at every pixel, and the GPU keeps up just fine.
For example, click on the image below to see a live simulation of roiling clouds. When you follow the link, you can also see the complete vertex and fragment shader code that generated the simulation.
This cloudy skies simulation was created by calling 3D noise multiple times at different scales. I find that I can call noise up to 8 times per pixel and still maintain a steady frame rate of 60 frames per second on my phone.
Let’s work out some numbers. The simulation itself is 1000×1000, so that’s one million pixels.
My noise implementation calls the cosine function 4 times to compute a repeatable random number. So to evaluate noise once, that’s 4 cosine functions for each of the x,y,z axes at the 8 corners of a cube.
That’s 4x3x8 = 96 cosine computations. Multiply that by 8 calls to the noise function per pixel, then again by one million pixels, and then again by 60 frames per second.
The result? More than 46 billion calls to the cosine function every second — not counting all the other computations involved. And it all runs just fine on the low power GPU of a smartphone.
Pretty cool, yes?