layerCullSpherical
Whether the Camera uses spherical distance instead of planar distance for per-layer culling.
Read time 2 minutesLast updated 11 days ago
Definition
- Type: Property
- Namespace: UnityEngine
- Assembly: UnityEngine.CoreModule
public bool layerCullSpherical { get; set; }
Remarks
Normally this type of culling is performed by moving the Camera's far plane closer to the eye. By setting this value to true, the culling is instead based on spherical distance. The benefit is that rotating on the same spot does not affect which objects are visible.
Per-layer culling trades shadow accuracy for performance. Culled shadow casters cast no shadows, so shadows can be missing, or can appear and disappear as the Camera moves.
When the value is false, Unity culls an object when its whole bounding box is farther than the cull distance along the Camera's view direction. Unity doesn't cull shadow casters behind the Camera, however far away they are. It also doesn't cull casters to the side of the Camera that are within the cull distance along the view direction. This limitation also applies to Light.layerShadowCullDistances.
Unity keeps every caster whose shadow can fall inside the view frustum within the shadow distance. When the light is at a low angle, these casters can cast long shadows into view and increase the cost of shadow map rendering. To cull these casters by their distance from the Camera, set layerCullSpherical to true.
When the value is true, Unity measures the distance from the Camera to the center of each renderer's bounding box. As a result, a large object can disappear while part of it is still closer than the cull distance.
Objects and shadows that cross the cull distance appear or disappear immediately, without a fade, which causes visible pop-in when the Camera moves. A shadow can extend far from its caster, especially when the light is at a low angle. As a result, a shadow can disappear close to the Camera even when its caster is far away.
To make pop-in less visible, use a cull distance at which the objects are too small to notice. For layers that contain objects with long shadows, use longer distances. Alternatively, use fog to hide distant objects as they appear. Fog doesn't hide shadows that disappear close to the Camera.
Per-layer cull distances don't apply to renderers that BatchRendererGroup draws. This includes renderers that the GPU Resident Drawer and the Entities Graphics package draw.
Additional Resources: Camera.layerCullDistances, Light.layerShadowCullDistances.