Algorithm
|
The outline of my algorithm to create noise is very simple.
Given an input point P,
look at each of the surrounding grid points.
In two dimensions there will be four surrounding grid points;
in three dimensions there will be eight.
In n dimensions, a point will have 2n
surrounding grid points.
For each surrounding grid point Q, choose a pseudo-random gradient vector G. It is very important that for any particular grid point you always choose the same gradient vector. Compute the inner product G . (P-Q). This will give the value at P of the linear function with gradient G which is zero at grid point Q. Now you have 2n of these values. Interpolate between them down to your point, using an S-shaped cross-fade curve (eg: 3t2-2t3) to weight the interpolant in each dimension. This step will require computing n S curves, followed by 2n-1 linear interpolations. Click on item 3 to the left to follow these steps one by one. |