public static class VfxNoiseA noise field a compute shader can reproduce, and the curl of one.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
Value noise over a lattice, not gradient noise. Perlin and simplex both need a table of gradients, and a table is the one thing the GPU side would have to be given rather than compute — a uniform buffer, an upload, and a way for the two to disagree about its contents. Value noise needs nothing but the hash that is already here: the corners of the unit cell hash to numbers, and the point between them is an interpolation. It has visible axis alignment at low frequencies, which is why turbulence sums octaves.
Curl, because divergence-free is what makes it read as fluid. Sampling noise straight into a velocity gives particles that pile up wherever the field points inward and thin out where it points out — a field with sources and sinks, which no fluid has. The curl of any vector field has zero divergence identically, so taking one costs three extra samples per axis and buys smoke that swirls instead of smoke that clumps.
Every step is exact or nearly so on both sides. The lattice hash is the integer one from VfxRandom, so the corner values agree bit for bit; the interpolation and the finite differences are ordinary float arithmetic, which agrees to the last bit or two. That is the same honest claim the rest of the module makes.
Fields and properties (1)
public const float EpsilonHow far apart the samples of the finite difference are.
Methods (3)
public static float Value(Vector3 point, uint seed)A value in [0, 1) that varies smoothly with position.
public static Vector3 Curl(Vector3 point, uint seed)The curl of a three-channel noise potential: a divergence-free vector field.
public static Vector3 Turbulence(Vector3 point, uint seed, int octaves)Several octaves of curl, each half the amplitude and twice the frequency.
Used by (4)
- VfxForceTestsVixen.Vfx.Tests
- VfxShaderEmitterVixen.Vfx
- VfxShaderEmitterTestsVixen.Vfx.Tests
- VfxSimulationVixen.Vfx