Version: 2023.1
LanguageEnglish
  • C#

ScriptableCullingParameters

struct in UnityEngine.Rendering

/

Implemented in:UnityEngine.CoreModule

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

Parameters that configure a culling operation in the Scriptable Render Pipeline.

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 CullingResults struct here // See ScriptableRenderContext.DrawRenderers for details and examples // …

// Execute all of the scheduled operations, in order context.Submit(); } } }

See Also: Camera.TryGetCullingParameters, ScriptableRenderContext.Cull, CullingResults, ScriptableRenderContext.DrawRenderers.

Static Properties

cullingJobsLowerLimitThe lower limit to the value ScriptableCullingParameters.maximumPortalCullingJobs.
cullingJobsUpperLimitThe upper limit to the value ScriptableCullingParameters.maximumPortalCullingJobs.
layerCountThe amount of layers available.
maximumCullingPlaneCountMaximum amount of culling planes that can be specified.

Properties

accurateOcclusionThresholdThis parameter determines query distance for occlusion culling.
cameraPropertiesCamera Properties used for culling.
conservativeEnclosingSphereThis 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.
cullingMaskThe mask for the culling operation.
cullingMatrixThe matrix for the culling operation.
cullingOptionsFlags to configure a culling operation in the Scriptable Render Pipeline.
cullingPlaneCountNumber of culling planes to use.
isOrthographicIs the cull orthographic.
lodParametersLODParameters for culling.
maximumPortalCullingJobsThis parameter controls how many active jobs contribute to occlusion culling.
maximumVisibleLightsThis parameter controls how many visible lights are allowed.
numIterationsEnclosingSphere
originPosition for the origin of the cull.
reflectionProbeSortingCriteriaReflection Probe Sort options for the cull.
shadowDistanceShadow distance to use for the cull.
shadowNearPlaneOffsetOffset to apply to the near camera plane when performing shadow map rendering.
stereoProjectionMatrixThe projection matrix generated for single-pass stereo culling.
stereoSeparationDistanceDistance between the virtual eyes.
stereoViewMatrixThe view matrix generated for single-pass stereo culling.

Public Methods

GetCullingPlaneFetch the culling plane at the given index.
GetLayerCullingDistanceGet the distance for the culling of a specific layer.
SetCullingPlaneSet the culling plane at a given index.
SetLayerCullingDistanceSet the distance for the culling of a specific layer.