public struct SphericalHarmonicsL1An irradiance probe's whole payload: four numbers per channel.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
A struct where SphericalHarmonicsL2 is a class, and the difference is the use. One of those describes a scene's sky and there is one of it; a brick of an irradiance field holds sixty-four of these and a clipmap holds thousands of bricks. At that count an object header per probe is most of the memory, and the array has to be contiguous anyway because it is copied into a volume texture.
Four coefficients, not nine, and it is not a compromise. Diffuse lighting is a cosine-weighted integral over the whole sphere and a Lambertian surface cannot see detail sharper than the lobe that blurs it. The second band buys a little directional contrast and costs more than twice the storage of the whole payload — so L1 is what both Unity's adaptive probe volumes and Epic's volumetric lightmap ship as their default, and it is what docs/plan/19 § 3 asks for.
The basis is SphericalHarmonicsL2's, truncated, and a test says so. Two derivations of the same four functions is how a probe and a skylight end up disagreeing about which way +Y is — the same argument that made a reflection probe's cube faces come out of the shadow projection rather than a table.
Irradiance returns irradiance divided by π, which is the quantity a shader multiplies by albedo. Getting that factor wrong is the classic "everything is π times too bright" bug, so the constant test is exact rather than approximate.
Fields and properties (6)
public const int CountHow many coefficients one band plus the constant is.
public readonly Vector3 L00The constant term — the average radiance over the whole sphere.
public readonly Vector3 L1m1The linear term along Y.
public readonly Vector3 L10Along Z.
public readonly Vector3 L11Along X.
public static SphericalHarmonicsL1 ZeroA probe that has seen nothing.
Methods (13)
public SphericalHarmonicsL1(Vector3 l00, Vector3 l1m1, Vector3 l10, Vector3 l11)A probe holding four given coefficients.
public static void Evaluate(Vector3 direction, Span<float> basis)The four basis functions in a direction.
public readonly SphericalHarmonicsL1 Accumulated(Vector3 direction, Vector3 radiance, float solidAngle)Adds one sample of radiance arriving from a direction.
public readonly Vector3 Irradiance(Vector3 normal)The diffuse lighting arriving at a surface facing a direction, divided by π.
public readonly Vector3 Radiance(Vector3 direction)The radiance arriving from a direction, as far as four coefficients can say.
public static SphericalHarmonicsL1 Lerp(SphericalHarmonicsL1 from, SphericalHarmonicsL1 to, float amount)One probe blended toward another.
public readonly SphericalHarmonicsL1 Scaled(float scale)This probe with every coefficient multiplied.
public static SphericalHarmonicsL1 From(SphericalHarmonicsL2 wider)The first four coefficients of a nine-coefficient probe.
public readonly bool Equals(SphericalHarmonicsL1 other)Indicates whether the current object is equal to another object of the same type.
public override readonly bool Equals(object? obj)Indicates whether this instance and a specified object are equal.
public override readonly int GetHashCode()Returns the hash code for this instance.
public static bool operator ==(SphericalHarmonicsL1 left, SphericalHarmonicsL1 right)Whether two probes hold the same coefficients.
public static bool operator !=(SphericalHarmonicsL1 left, SphericalHarmonicsL1 right)Whether two probes hold different coefficients.
Used by (25)
- AdaptiveProbeTestsVixen.Rendering.ScreenProbes.Tests
- AtlasConventionTestsVixen.Rendering.ScreenProbes.Tests
- CapturedIrradianceFillerVixen.Rendering
- CornellBoxTestsVixen.Rendering.SurfaceCache.Tests
- ExitCriteriaTestsVixen.Rendering.ScreenProbes.Tests
- IrradianceCaptureDeviceTestsVixen.Graphics.Golden.Tests
- IrradianceCoarseningTestsVixen.Rendering.IrradianceFields.Tests
- IrradianceFieldVixen.Rendering.IrradianceFields
- IrradianceFieldTextureVixen.Rendering
- IrradianceFillDeviceTestsVixen.Graphics.Golden.Tests
- IrradianceProbeVixen.Rendering.IrradianceFields
- IrradianceProbeTestsVixen.Rendering.IrradianceFields.Tests
- IrradianceRepairDeviceTestsVixen.Graphics.Golden.Tests
- SamplingConventionTestsVixen.Rendering.IrradianceFields.Tests
- ScreenProbeAccumulateDeviceTestsVixen.Graphics.Golden.Tests
- ScreenProbeAtlasVixen.Rendering.ScreenProbes
- ScreenProbeHistoryVixen.Rendering.ScreenProbes
- ScreenProbeHistoryTestsVixen.Rendering.ScreenProbes.Tests
- ScreenProbeHistoryTextureVixen.Rendering
- ScreenProbeResolveDeviceTestsVixen.Graphics.Golden.Tests
- ScreenProbeTextureVixen.Rendering
- SphericalHarmonicsL1TestsVixen.Core.Imaging.Tests
- TracedIrradianceFillerVixen.Rendering.IrradianceFields
- TracedScreenProbeGatherVixen.Rendering.ScreenProbes
- TracedScreenProbeGatherTestsVixen.Rendering.ScreenProbes.Tests