Table of Contents

Class ShadowCascadeCulling

Namespace
FishMMO.Client
Assembly
FishMMO.Client.dll

This camera's main-light shadow cascades, handed to the vegetation's shadow caster before the shadow maps are drawn, so a GPU-driven tree draws only into the cascades that need it (FishVegetationPasses.hlsl VegCasterCulled).

public static class ShadowCascadeCulling
Inheritance
ShadowCascadeCulling
Inherited Members

Remarks

An indirect draw (Graphics.RenderMeshIndirect) has one set of bounds round the camera, so URP puts every one into every cascade's caster list, and URP's own cross-cascade culling is off (ShadowUtils sets shadowCascadeBlendCullingFactor 1): every tree near the camera was drawn into all four cascades, its whole vertex stage run four times, and every far one into the three maps that do not even cover it. The trees' shadows were 0.65 ms, all of it vertex work (ScenePerfProbe, Flo Monolith's meadow, 2026-10-08).

The caster cannot cull without knowing which cascade it is drawing and where each one is. URP keeps both to itself (its slices are internal), so they are worked out again here exactly as URP works them out (ShadowCulling .CullShadowCasters → ShadowUtils.ExtractDirectionalLightMatrix: the same light, cascade count, split, tile resolution and near plane, through the public CullingResults call), for this camera and this frame, and set as globals by a pass just before the shadows — never stale, and right for each camera when the Scene and Game views alternate. Which cascade a caster is drawing it tells from the projection itself: each cascade's orthographic half size is its culling sphere's radius, and the radii differ several-fold.

Fields

Enabled

Off: every caster is drawn into every cascade, as before (the probe's A/B, variant nocascadecull).

public static bool Enabled

Field Value

bool

Pass

The pass that publishes them; enqueued by FishCloudsFeature for every camera (every renderer carries it).

public static readonly ScriptableRenderPass Pass

Field Value

ScriptableRenderPass

Properties

LastReport

What the last game camera published, for probes: each cascade's sphere radius against its projection's half size.

public static string LastReport { get; }

Property Value

string

Remarks

Formatted only when read. The pass records the raw numbers every frame (no allocation); building this string in the pass itself was ~2.7 KB of garbage every frame for a line a probe reads once.

Methods

TryLastCascade(int, out Vector4, out Matrix4x4, out float, out float)

Diagnosis: the last game camera's cascade i: its sphere, shadow view, and near/far depths.

public static bool TryLastCascade(int i, out Vector4 sphere, out Matrix4x4 view, out float near, out float far)

Parameters

i int
sphere Vector4
view Matrix4x4
near float
far float

Returns

bool