Plush

SplatMath#

PlushEngine · Type index

Namespace: PlushEngine.Effects (using PlushEngine.Effects;)

The closed form behind Splats, as a CPU reference for checks and tools. Shaders/Models/Volume.slang evaluates the same expressions per pixel. A splat is a spheroid Gaussian: density ρ(x) = ρ₀·exp(−½(x−μ)ᵀΣ⁻¹(x−μ)), with Σ⁻¹ = β·I + (α − β)·u uᵀ (α = 1/σ_along², β = 1/σ_across², u the long axis).

public static class SplatMath

Members: Erf · Integral

Erf#

public static float Erf(float x);

erf(x) by Winitzki's approximation (absolute error below 2e-4), the one the shader uses.

Integral#

public static float Integral(Vector3 origin, Vector3 direction, float t0, float t1, Vector3 center, Vector3 axis, float sigmaAlong, float sigmaAcross);

∫ ρ/ρ₀ dt along origin + t·direction (unit) for t in [t0, t1]: exp(−½(c − b²/a))·√(π/2a)·[erf(√(a/2)(t1 − b/a)) − erf(√(a/2)(t0 − b/a))], with a = dᵀΣ⁻¹d, b = dᵀΣ⁻¹(μ−o), c = (μ−o)ᵀΣ⁻¹(μ−o).

Source#