|
|
| PerlinSDF () noexcept |
| | Default constructor. Constructs a single-octave Perlin noise field with unit amplitude, unit frequency along all axes, and persistence 0.5: the full constructor with those values.
|
| |
| | PerlinSDF (const T a_noiseAmplitude, const Vec3T< T > a_noiseFrequency, const T a_noisePersistence, const unsigned int a_noiseOctaves) noexcept |
| | Full constructor.
|
| |
|
| PerlinSDF (const PerlinSDF &)=default |
| | Copy constructor.
|
| |
|
| PerlinSDF (PerlinSDF &&)=default |
| | Move constructor.
|
| |
| PerlinSDF & | operator= (const PerlinSDF &)=default |
| | Copy assignment.
|
| |
| PerlinSDF & | operator= (PerlinSDF &&)=default |
| | Move assignment.
|
| |
| T | signedDistance (const Vec3T< T > &a_point) const noexcept |
| | Signed distance function. Generates a noise value on [0, m_noiseAmplitude] for one octave.
|
| |
| template<class URNG > |
| void | shuffle (URNG &g) noexcept |
| | Shuffle the permutation table with the provided uniform random number generator.
|
| |
| Array< int, 512 > & | getPermutationTable () noexcept |
| | Get the internal permutation table.
|
| |
| BoundingVolumes::AABBT< T > | computeBoundingVolume () const noexcept |
| | The shape's axis-aligned bounding box.
|
| |
|
| T | lerp (const T t, const T a, const T b) const noexcept |
| | Ken Perlin's linear interpolation helper.
|
| |
| T | fade (const T t) const noexcept |
| | Ken Perlin's fade (smoothstep) function: 6t^5 - 15t^4 + 10t^3.
|
| |
| T | grad (const int hash, const T x, const T y, const T z) const noexcept |
| | Ken Perlin's gradient hash function.
|
| |
| T | noise (const Vec3T< T > &a_point) const noexcept |
| | Single-octave Perlin noise evaluation.
|
| |
template<class T>
class EBGeometry::PerlinSDF< T >
Ken Perlin's gradient-noise implicit function.
This class evaluates multi-octave Perlin noise at a 3-D point and returns the result as a scalar. It is not a true signed distance function (the gradient magnitude is not guaranteed to equal 1), but it can serve as a procedural displacement field when added to or subtracted from a conventional SDF.
The output of signedDistance is on the range [0, m_noiseAmplitude] for a single octave. Multiple octaves sum scaled contributions: each successive octave divides the spatial frequency by m_noisePersistence (doubling it at the default 0.5) and multiplies the amplitude by m_noisePersistence.
The full constructor shuffles the permutation table with a std::mt19937 seeded with 0, so every PerlinSDF built with the same parameters is the same noise field; call shuffle() for another.
- Template Parameters
-
| T | Floating-point precision. |
template<class T >
template<class URNG >
Shuffle the permutation table with the provided uniform random number generator.
Resets the first 256 entries of the permutation table to 0, ..., 255, permutes them with std::shuffle and then mirrors them into the upper 256 entries. The URNG type must satisfy the C++ UniformRandomBitGenerator concept (e.g., std::mt19937).
- Template Parameters
-
| URNG | Uniform random number generator type (e.g., std::mt19937). |
- Parameters
-
| [in] | g | Uniform random number generator instance to drive the shuffle. |
- Note
- When using parallel calculations it is exceptionally important that the input RNG produces the same sequence across all threads/ranks. Otherwise, each thread/rank will generate a different permutation table and therefore a different noise field, resulting in no single coherent geometry.