Vixen
02b45cc4
csharp
public struct RenderLight

One light as a host authors it: physical units, angles in radians, colour separate from intensity.

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

Remarks

Deliberately not the layout the GPU reads. An author sets a colour and an intensity and a cone half-angle; a shader wants a premultiplied radiance and the cosine of that angle. Keeping the two apart means the trigonometry happens once per light per frame rather than once per light per fragment, and it means changing the GPU record's packing does not change what a scene file says.

Radius is a sphere-light radius rather than a falloff distance: it widens the specular highlight instead of the reach. Range is the reach.

Fields and properties (15)

  • public LightKind Kind

    Which kind of light this is.

  • public Vector3 Position

    Where it is. Unused by a directional light.

  • public Vector3 Direction

    Which way it points, away from the light. Unused by a point light.

  • public Color3 Colour

    Its colour, before intensity and before Temperature.

  • public float Intensity

    How bright it is, in Unit.

  • public LightUnit Unit

    What Intensity is measured in.

  • public float Temperature

    Its colour temperature in kelvin, or zero to use Colour alone.

  • public float Range

    The distance at which its contribution reaches zero.

  • public float Radius

    Its sphere radius. Zero for a punctual light.

  • public float InnerAngle

    The inner cone half-angle in radians, inside which a spot is at full brightness.

  • public float OuterAngle

    The outer cone half-angle in radians, outside which a spot contributes nothing.

  • public Vector3 Tangent

    A shaped light's own axis: along a tube, or across a rectangle's width.

  • public float HalfLength

    Half a tube's length, or half a rectangle's width. Zero for a punctual light.

  • public int ShadowTile

    Which tile of the frame's punctual shadow atlas shadows it, counted from one. Zero is none.

  • public readonly Vector3 Radiance

    What the shader multiplies: the tinted colour times the converted intensity.

Methods (6)

  • public static RenderLight Directional(Vector3 direction, Color3 colour, float intensity = 1)

    A directional light, which needs no position and no range.

  • public static RenderLight Point(Vector3 position, float range, Color3 colour, float intensity = 1)

    A point light.

  • public static RenderLight Spot(Vector3 position, Vector3 direction, float range, float innerAngle, float outerAngle, Color3 colour, float intensity = 1)

    A spot light, with half-angles in radians.

  • public static RenderLight Tube(Vector3 position, Vector3 axis, float halfLength, float radius, float range, Color3 colour, float intensity = 1)

    A tube light: a segment of a given radius, lit along its whole length.

  • public static RenderLight Rect(Vector3 position, Vector3 normal, Vector3 axis, float halfWidth, float halfHeight, float range, Color3 colour, float intensity = 1)

    A rectangular panel, emitting from one face.

  • public readonly PunctualLightData ToGpu()

    This light in the layout the shader reads.

Used by (25)

  • ArenaThirdPersonShooter
  • BufferTransferDeviceTestsVixen.Graphics.Golden.Tests
  • ClusterCullingDeviceTestsVixen.Graphics.Golden.Tests
  • ClusteredLightingTestsVixen.Rendering.Tests
  • ClusteredShadingDeviceTestsVixen.Graphics.Golden.Tests
  • ForwardFrameTestsVixen.Rendering.Tests
  • ForwardLightingRenderFeatureVixen.Rendering
  • ForwardLightingTestsVixen.Rendering.Tests
  • IPunctualLightSourceVixen.Rendering
  • ISunSourceVixen.Rendering
  • LightExtractionSystemVixen.Rendering
  • LightExtractionTestsVixen.Rendering.Tests
  • ObjectRecordTestsVixen.Rendering.Tests
  • ParticleLightTestsVixen.Rendering.Tests
  • ParticleLightsVixen.Rendering
  • PhotometryTestsVixen.Rendering.Tests
  • PunctualShadowRendererVixen.Rendering
  • PunctualShadowTestsVixen.Rendering.Tests
  • SceneLightingVixen.Rendering
  • SceneLightingTestsVixen.Rendering.Tests
  • ShadowMapRendererVixen.Rendering
  • ShadowMapRendererTestsVixen.Rendering.Tests
  • SunlightVixen.Rendering.Tests
  • SunlightVixen.Rendering.Tests
  • VirtualShadowRendererVixen.Rendering