Class FishDepthPyramid
Each game camera's depth as a pyramid of farthest depths, built after its opaques, for the GPU culling of the instanced props, trees and details to drop what was hidden behind what was drawn (FishTerrainInstancing.compute FishOccluded, main view only).
public static class FishDepthPyramid
- Inheritance
-
FishDepthPyramid
- Inherited Members
Remarks
Unity's own occlusion culling works only for static scene renderers; the props are data drawn indirectly (CliffRockInstancing), so nothing culled them behind a hill. The pyramid is last frame's: a prop's sphere is grown by how far the camera has moved since, and anything off last frame's screen is drawn, so a step reveals what it should. One atlas holds every level (level 0 at half the screen, the rest beside it), so one read-write texture builds and serves it.
Fields
Enabled
Off: nothing is culled by occlusion (the probe's A/B).
public static bool Enabled
Field Value
MaxMoveMetres
A camera that has moved further than this since its pyramid was drawn culls nothing by it.
public const float MaxMoveMetres = 30
Field Value
Pass
The pass that builds a camera's pyramid; enqueued by FishCloudsFeature for game cameras.
public static readonly ScriptableRenderPass Pass
Field Value
- ScriptableRenderPass
Methods
Bind(CommandBuffer, ComputeShader, int, Camera, Vector3, bool)
Hands the culling kernel this camera's pyramid, or tells it to cull nothing by occlusion: none yet, an old
one, a camera that has jumped, or allowed false (a diagnostic comparing with the CPU
mirror, which knows nothing of depth).
public static void Bind(CommandBuffer cmd, ComputeShader shader, int kernel, Camera camera, Vector3 eye, bool allowed)
Parameters
Clear()
Forgets every camera's pyramid (a scene unloaded, the renderer torn down).
public static void Clear()