ScriptableCullingParameters
Parameters that configure a culling operation in the Scriptable Render Pipeline.
Read time 3 minutesLast updated 4 days ago
Definition
- Type: Struct
- Namespace: UnityEngine.Rendering
- Assembly: UnityEngine.CoreModule
- Implements: IEquatable<ScriptableCullingParameters>
public struct ScriptableCullingParameters : IEquatable<ScriptableCullingParameters>
Remarks
Obtain a ScriptableCullingParameters struct by calling Camera.TryGetCullingParameters.
Note that you can obtain and view a ScriptableCullingParameters struct from a Camera in the Built-in Render Pipeline; however, changing the values has no effect.
The following Scriptable Render Pipeline code demonstrates how to obtain a ScriptableCullingParameters struct from a Camera using Camera.TryGetCullingParameters, configure the struct, and then pass the struct to ScriptableRenderContext.Cull to obtain a CullingResults struct. You can then use the CullingResults struct in a call to ScriptableRenderContext.DrawRenderers.
using UnityEngine;using UnityEngine;using UnityEngine.Rendering;public class ExampleRenderPipelineInstance : RenderPipeline{ public ExampleRenderPipelineInstance() { } protected override void Render(ScriptableRenderContext context, Camera[] cameras) { // Get the culling parameters from the desired Camera if (cameras[0].TryGetCullingParameters(out var cullingParameters)) { // Change culling parameters to configure the culling operation cullingParameters.cullingOptions &= ~CullingOptions.OcclusionCull; cullingParameters.isOrthographic = false; // Schedule the cull operation CullingResults cullingResults = context.Cull(ref cullingParameters); // Place code that schedules drawing operations using the <see cref="UnityEngine.Rendering.CullingResults"></see> struct here // See <see cref="UnityEngine.Rendering.ScriptableRenderContext.DrawRenderers"></see> for details and examples // … // Execute all of the scheduled operations, in order context.Submit(); } }}
Additional Resources: Camera.TryGetCullingParameters, ScriptableRenderContext.Cull, CullingResults, ScriptableRenderContext.DrawRenderers.
Static Fields
Value | Description |
|---|---|
| layerCount | The amount of layers available. |
| maximumCullingPlaneCount | Maximum amount of culling planes that can be specified. |
Properties
Property | Description |
|---|---|
| accurateOcclusionThreshold | This parameter determines query distance for occlusion culling. |
| cameraProperties | Camera Properties used for culling. |
| conservativeEnclosingSphere | This property enables a conservative method for calculating the size and position of the minimal enclosing sphere around the frustum cascade corner points for shadow culling. |
| cullingMask | The mask for the culling operation. |
| cullingMatrix | The matrix for the culling operation. |
| cullingOptions | Flags to configure a culling operation in the Scriptable Render Pipeline. |
| cullingPlaneCount | Number of culling planes to use. |
| isOrthographic | Is the cull orthographic. |
| lodParameters | LODParameters for culling. |
| maximumPortalCullingJobs | This parameter controls how many active jobs contribute to occlusion culling. |
| maximumVisibleLights | This parameter controls how many visible lights are allowed. |
| origin | Position for the origin of the cull. |
| reflectionProbeSortingCriteria | Reflection Probe Sort options for the cull. |
| shadowDistance | Shadow distance to use for the cull. |
| shadowNearPlaneOffset | Offset to apply to the near camera plane when performing shadow map rendering. |
| splitPlaneCount | The number of split culling planes to use. |
| stereoProjectionMatrix | The projection matrix generated for single-pass stereo culling. |
| stereoSeparationDistance | Distance between the virtual eyes. |
| stereoViewMatrix | The view matrix generated for single-pass stereo culling. |
Static Properties
Property | Description |
|---|---|
| cullingJobsLowerLimit | The lower limit to the value ScriptableCullingParameters.maximumPortalCullingJobs. |
| cullingJobsUpperLimit | The upper limit to the value ScriptableCullingParameters.maximumPortalCullingJobs. |
Methods
Method | Description |
|---|---|
| GetCullingPlane | Fetch the culling plane at the given index. |
| GetLayerCullingDistance | Get the distance for the culling of a specific layer. |
| GetSplitCullingPlane | Fetch the split culling plane at the given index. |
| SetCullingPlane | Set the culling plane at a given index. |
| SetLayerCullingDistance | Set the distance for the culling of a specific layer. |
| SetSplitCullingPlane | Set the split culling plane at a given index. |