Skip to content

Class ClusterGrid

Namespace: Apogee.Rendering
Assembly: Apogee.Rendering.dll

The grid lights are culled against: 16 x 9 cells over the screen and 24 slices in depth, spaced exponentially from the camera's near plane to so that near slices are thin. This is the CPU twin of the shaders (cluster_build and common.slang), for tests and tools.

public static class ClusterGrid

Inheritance

object ← ClusterGrid

Inherited Members

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()

Fields

CountX

public const int CountX = 16

Field Value

int

CountY

public const int CountY = 9

Field Value

int

CountZ

public const int CountZ = 24

Field Value

int

MaxLightsPerCluster

public const int MaxLightsPerCluster = 64

Field Value

int

Stride

Uints per cluster in the light list: the count, then the indices.

public const int Stride = 65

Field Value

int

Total

public const int Total = 3456

Field Value

int

Methods

Bounds(int, int, int, float, float, float, float)

The view-space box around a cluster. projX and projY are the projection's [0,0] and [1,1] (the latter negative).

public static (Vector3 Min, Vector3 Max) Bounds(int x, int y, int z, float near, float far, float projX, float projY)

Parameters

x int

y int

z int

near float

far float

projX float

projY float

Returns

(Vector3 Min, Vector3 Max)

Index(int, int, int)

public static int Index(int x, int y, int z)

Parameters

x int

y int

z int

Returns

int

SliceDepth(float, float, int)

The distance in front of the camera where slice slice starts (slice 24 is the far end).

public static float SliceDepth(float near, float far, int slice)

Parameters

near float

far float

slice int

Returns

float

SliceOf(float, float, float)

The slice a distance in front of the camera falls in; closer than near is slice 0, farther than far the last.

public static int SliceOf(float near, float far, float viewDepth)

Parameters

near float

far float

viewDepth float

Returns

int