
32 IDiscovering
Figure 3.2. A32× 32 grid evenly spaced in the xy plane; each point’s z component is
determined by a 3D noise function given the xy position and the current time.
To get a feel for the performance difference, we ported the 3D simplex noise
function discussed in Chapter 7 from GLSL to both C++ and JavaScript for use in
a CPU-intensive application. We then wrote code that perturbs a 2D grid originally
in the xy plane over time. At each time step, the z component for each grid point is
computed as z = snoise(x, y, time) on the CPU. To render a wireframe like
that shown in Figure 3.2, we use trivial shaders, store x and y in a static vertex ...