Vixen
02b45cc4
csharp
public sealed class CubeImage

A cube map in memory, linear and floating point: what a bake reads and writes.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

Deliberately not a Texture. Everything that produces an environment — projecting it into spherical harmonics, prefiltering it per roughness — is arithmetic over radiance values, and doing it here rather than on the GPU means it is deterministic, testable without a device, and runs where a bake belongs: in the asset pipeline, once, rather than in a frame.

Linear radiance, not encoded colour. An environment prefiltered in sRGB is a different integral from one prefiltered in linear, and it is wrong in the direction that looks plausible — slightly washed out, which reads as the tone mapping.

Fields and properties (2)

  • public int Size

    How many texels across one face is.

  • public ReadOnlySpan<Vector3> Pixels

    Every face's texels, in layer order, each face row-major.

Methods (7)

  • public CubeImage(int size)

    Creates an empty cube of a given face size.

  • public Span<Vector3> Face(CubeFace face)

    One face's texels, row-major.

  • public ref Vector3 At(CubeFace face, int x, int y)

    One texel, by face and integer coordinates.

  • public Vector3 DirectionOf(CubeFace face, int x, int y)

    Where the centre of a texel looks.

  • public float SolidAngleOf(int x, int y)

    How much of the sphere a texel covers, in steradians.

  • public Vector3 Sample(Vector3 direction)

    The texel a direction lands on.

  • public static CubeImage Uniform(int size, Vector3 radiance)

    A cube of one colour, which is the case every analytic expectation is written for.

Used by (15)

  • ArenaFrameThirdPersonShooter
  • CapturedIrradianceFillerVixen.Rendering
  • CapturedIrradianceFillerTestsVixen.Rendering.Tests
  • EnvironmentBakerVixen.Rendering
  • EnvironmentLightingTestsVixen.Rendering.Tests
  • EnvironmentTextureVixen.Rendering
  • IrradianceCaptureVixen.Rendering
  • IrradianceCaptureDeviceTestsVixen.Graphics.Golden.Tests
  • IrradianceCubeCaptureVixen.Rendering
  • OpenSkyVixen.Rendering.Tests
  • PhysicalSkyVixen.Rendering
  • PhysicalSkyTestsVixen.Rendering.Tests
  • ReflectionProbeMissVixen.Rendering
  • ReflectionTraceDeviceTestsVixen.Graphics.Golden.Tests
  • SphericalHarmonicsVixen.Rendering