The formula for the radius $r$ is simple.
$$r^2 = \frac {1} {2}$$
This holds for all values of $N$. Let me explain.
The simplex noise kernel summation radius $r$ should be the height of the N-simplex. If the kernel summation radius is larger than this, the kernel contribution will extend outside of the simplex. This will cause visual discontinuities because contributions are only added to the containing simplex, and not the surrounding simplices.
The height of the N-simplex as a function of N is as follows.
$$ r = h = s\sqrt{\frac {N+1} {2N}} $$
$s$ is the length of an edge, or the distance from one vertex to another. To find this value, unskew $[1, 1 \cdots 1]$ and get the distance to $[0, 0 \cdots 0]$. Note that $unskew([0, 0 \cdots 0])$ is $[0, 0 \cdots 0]$. Using the origin like this simplifies the math.
$$ s = \sqrt{\frac {N} {N+1}} = \sqrt {N \left({1 + N \frac {\frac {1} {\sqrt {N+1}} - 1} {N}}\right) ^2} = \sqrt {unskew([1, 1 \cdots 1]) \cdot unskew([1, 1 \cdots 1])} $$
We can now use this this to calculate $r$ as a function of $N$.
$$ r = h = \sqrt{\frac {1} {2}} = \sqrt{\frac {N} {N+1}} \sqrt{\frac {N+1} {2N}} $$
$N$ and $N+1$ divide out and the useful term, $r^2$, always works out to $\frac {1} {2}$.
The contribution of each vertex is given by the following formula.
$$max(r^2-d^2, 0)^a \cdot (\vec{d} \cdot \vec{g})$$
$d^2$ is the squared distance from the vertex to the input point. $\vec{d}$ is the displacement vector and $\vec{g}$ is the N-dimensional gradient. My understanding is that the amplitude is $a$ in the above formala. It can be whatever you want it to be. It is 4 in Ken Perlin's reference implementation. Different values give different visual noise. Think of it as desired smoothness.
Also note that you may want a normalization factor to clamp output to a range of -1 to +1. Perlin's reference implementation uses 8. Gustavson uses different factors for different values of $N$.
Sharpe claims the following formula can be used to calculate the normalization factor $n$ as a function of $N$.
$$n = \frac {1} {\sqrt{\frac {N} {N+1}} \left( r^2 – \frac {N} {4 (N+1)} \right) ^ a} = \frac {1} {2{\frac s 2} \left( r^2 – \left( {\frac s 2} \right) ^2 \right) ^ a}$$
I am not convinced $2{\frac s 2}$ actually equates to $2(\vec{d} \cdot \vec{g})$. Sharpe is probably right that the minimum and maximum values occur on edge midpoints. I have not been able to independently verify this.
If the ideally contributing gradient $\vec{g}$ is $[1, 1 \cdots 1]$ and an edge midpoint $\vec{d}$ is $unskew([\frac 1 2,\frac 1 2 \cdots \frac 1 2])$, then $2(\vec{d} \cdot \vec{g})$ works out to the following.
$$ s = {\frac {N} {\sqrt {N+1}}} = 2N \left({\frac 1 2 + \frac 1 2 N \frac {\frac {1} {\sqrt {N+1}} - 1} {N}}\right) = 2 (unskew([\frac 1 2,\frac 1 2 \cdots \frac 1 2]) \cdot [1, 1 \cdots 1]) $$
Assuming Sharpe is right about edge midpoints, the scaling factor $n$ as a function of $N$ is as follows.
$$n = \frac {1} {{\frac {N} {\sqrt {N+1}}} \left( r^2 – \frac {N} {4 (N+1)} \right) ^ a} = \frac {1} {2(\vec{d} \cdot \vec{g}) \left( r^2 – \left( {\frac s 2} \right) ^2 \right) ^ a}$$
Note that this assumes the ideally contributing gradient $\vec{g}$ is $[1, 1 \cdots 1]$ and not something like $[0, 1 \cdots 1]$. A different ideal gradient changes the dot product of $(\vec{d} \cdot \vec{g})$.
References I can't link to:
- Wikipedia - Simplex Noise
- Wikipedia - Simplex
- Simplex noise demystified, Stefan Gustavson