Class ScriptableRenderPass
ScriptableRenderPass implements a logical rendering pass that can be used to extend Universal RP renderer.
Inherited Members
Namespace: UnityEngine.Rendering.Universal
Syntax
[MovedFrom("UnityEngine.Rendering.LWRP")]
public abstract class ScriptableRenderPass
Constructors
ScriptableRenderPass()
Declaration
public ScriptableRenderPass()
Properties
clearColor
Declaration
public Color clearColor { get; }
Property Value
| Type | Description |
|---|---|
| Color |
clearFlag
Declaration
public ClearFlag clearFlag { get; }
Property Value
| Type | Description |
|---|---|
| ClearFlag |
colorAttachment
Declaration
public RenderTargetIdentifier colorAttachment { get; }
Property Value
| Type | Description |
|---|---|
| RenderTargetIdentifier |
colorAttachments
Declaration
public RenderTargetIdentifier[] colorAttachments { get; }
Property Value
| Type | Description |
|---|---|
| RenderTargetIdentifier[] |
depthAttachment
Declaration
public RenderTargetIdentifier depthAttachment { get; }
Property Value
| Type | Description |
|---|---|
| RenderTargetIdentifier |
input
The input requirements for the ScriptableRenderPass, which has been set using ConfigureInput
Declaration
public ScriptableRenderPassInput input { get; }
Property Value
| Type | Description |
|---|---|
| ScriptableRenderPassInput |
See Also
profilingSampler
Declaration
protected ProfilingSampler profilingSampler { get; set; }
Property Value
| Type | Description |
|---|---|
| ProfilingSampler |
renderPassEvent
Declaration
public RenderPassEvent renderPassEvent { get; set; }
Property Value
| Type | Description |
|---|---|
| RenderPassEvent |
Methods
Blit(CommandBuffer, RenderTargetIdentifier, RenderTargetIdentifier, Material, Int32)
Add a blit command to the context for execution. This changes the active render target in the ScriptableRenderer to destination.
Declaration
public void Blit(CommandBuffer cmd, RenderTargetIdentifier source, RenderTargetIdentifier destination, Material material = null, int passIndex = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | cmd | Command buffer to record command for execution. |
| RenderTargetIdentifier | source | Source texture or target identifier to blit from. |
| RenderTargetIdentifier | destination | Destination texture or target identifier to blit into. This becomes the renderer active render target. |
| Material | material | Material to use. |
| Int32 | passIndex | Shader pass to use. Default is 0. |
See Also
Configure(CommandBuffer, RenderTextureDescriptor)
This method is called by the renderer before executing the render pass.
Override this method if you need to to configure render targets and their clear state, and to create temporary render target textures.
If a render pass doesn't override this method, this render pass renders to the active Camera's render target.
You should never call CommandBuffer.SetRenderTarget. Instead call ConfigureTarget and ConfigureClear.
Declaration
public virtual void Configure(CommandBuffer cmd, RenderTextureDescriptor cameraTextureDescriptor)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | cmd | CommandBuffer to enqueue rendering commands. This will be executed by the pipeline. |
| RenderTextureDescriptor | cameraTextureDescriptor | Render texture descriptor of the camera render target. |
See Also
ConfigureClear(ClearFlag, Color)
Configures clearing for the render targets for this render pass. Call this inside Configure.
Declaration
public void ConfigureClear(ClearFlag clearFlag, Color clearColor)
Parameters
| Type | Name | Description |
|---|---|---|
| ClearFlag | clearFlag | ClearFlag containing information about what targets to clear. |
| Color | clearColor | Clear color. |
See Also
ConfigureInput(ScriptableRenderPassInput)
Configures Input Requirements for this render pass.
This method should be called inside ScriptableRendererFeature.AddRenderPasses.
Declaration
public void ConfigureInput(ScriptableRenderPassInput passInput)
Parameters
| Type | Name | Description |
|---|---|---|
| ScriptableRenderPassInput | passInput | ScriptableRenderPassInput containing information about what requirements the pass needs. |
See Also
ConfigureTarget(RenderTargetIdentifier)
Configures render targets for this render pass. Call this instead of CommandBuffer.SetRenderTarget. This method should be called inside Configure.
Declaration
public void ConfigureTarget(RenderTargetIdentifier colorAttachment)
Parameters
| Type | Name | Description |
|---|---|---|
| RenderTargetIdentifier | colorAttachment | Color attachment identifier. |
See Also
ConfigureTarget(RenderTargetIdentifier, RenderTargetIdentifier)
Configures render targets for this render pass. Call this instead of CommandBuffer.SetRenderTarget. This method should be called inside Configure.
Declaration
public void ConfigureTarget(RenderTargetIdentifier colorAttachment, RenderTargetIdentifier depthAttachment)
Parameters
| Type | Name | Description |
|---|---|---|
| RenderTargetIdentifier | colorAttachment | Color attachment identifier. |
| RenderTargetIdentifier | depthAttachment | Depth attachment identifier. |
See Also
ConfigureTarget(RenderTargetIdentifier[])
Configures render targets for this render pass. Call this instead of CommandBuffer.SetRenderTarget. This method should be called inside Configure.
Declaration
public void ConfigureTarget(RenderTargetIdentifier[] colorAttachments)
Parameters
| Type | Name | Description |
|---|---|---|
| RenderTargetIdentifier[] | colorAttachments |
See Also
ConfigureTarget(RenderTargetIdentifier[], RenderTargetIdentifier)
Configures render targets for this render pass. Call this instead of CommandBuffer.SetRenderTarget. This method should be called inside Configure.
Declaration
public void ConfigureTarget(RenderTargetIdentifier[] colorAttachments, RenderTargetIdentifier depthAttachment)
Parameters
| Type | Name | Description |
|---|---|---|
| RenderTargetIdentifier[] | colorAttachments | |
| RenderTargetIdentifier | depthAttachment | Depth attachment identifier. |
See Also
CreateDrawingSettings(List<ShaderTagId>, ref RenderingData, SortingCriteria)
Creates DrawingSettings based on current rendering state.
Declaration
public DrawingSettings CreateDrawingSettings(List<ShaderTagId> shaderTagIdList, ref RenderingData renderingData, SortingCriteria sortingCriteria)
Parameters
| Type | Name | Description |
|---|---|---|
| List<ShaderTagId> | shaderTagIdList | List of shader pass tag to render. |
| RenderingData | renderingData | Current rendering state. |
| SortingCriteria | sortingCriteria | Criteria to sort objects being rendered. |
Returns
| Type | Description |
|---|---|
| DrawingSettings |
See Also
CreateDrawingSettings(ShaderTagId, ref RenderingData, SortingCriteria)
Creates DrawingSettings based on current the rendering state.
Declaration
public DrawingSettings CreateDrawingSettings(ShaderTagId shaderTagId, ref RenderingData renderingData, SortingCriteria sortingCriteria)
Parameters
| Type | Name | Description |
|---|---|---|
| ShaderTagId | shaderTagId | Shader pass tag to render. |
| RenderingData | renderingData | Current rendering state. |
| SortingCriteria | sortingCriteria | Criteria to sort objects being rendered. |
Returns
| Type | Description |
|---|---|
| DrawingSettings |
See Also
Execute(ScriptableRenderContext, ref RenderingData)
Execute the pass. This is where custom rendering occurs. Specific details are left to the implementation
Declaration
public abstract void Execute(ScriptableRenderContext context, ref RenderingData renderingData)
Parameters
| Type | Name | Description |
|---|---|---|
| ScriptableRenderContext | context | Use this render context to issue any draw commands during execution |
| RenderingData | renderingData | Current rendering state information |
FrameCleanup(CommandBuffer)
Declaration
public virtual void FrameCleanup(CommandBuffer cmd)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | cmd |
OnCameraCleanup(CommandBuffer)
Called upon finish rendering a camera. You can use this callback to release any resources created by this render pass that need to be cleanup once camera has finished rendering. This method be called for all cameras in a camera stack.
Declaration
public virtual void OnCameraCleanup(CommandBuffer cmd)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | cmd | Use this CommandBuffer to cleanup any generated data |
OnCameraSetup(CommandBuffer, ref RenderingData)
This method is called by the renderer before rendering a camera
Override this method if you need to to configure render targets and their clear state, and to create temporary render target textures.
If a render pass doesn't override this method, this render pass renders to the active Camera's render target.
You should never call CommandBuffer.SetRenderTarget. Instead call ConfigureTarget and ConfigureClear.
Declaration
public virtual void OnCameraSetup(CommandBuffer cmd, ref RenderingData renderingData)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | cmd | CommandBuffer to enqueue rendering commands. This will be executed by the pipeline. |
| RenderingData | renderingData | Current rendering state information |
See Also
OnFinishCameraStackRendering(CommandBuffer)
Called upon finish rendering a camera stack. You can use this callback to release any resources created by this render pass that need to be cleanup once all cameras in the stack have finished rendering. This method will be called once after rendering the last camera in the camera stack. Cameras that don't have an explicit camera stack are also considered stacked rendering. In that case the Base camera is the first and last camera in the stack.
Declaration
public virtual void OnFinishCameraStackRendering(CommandBuffer cmd)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | cmd | Use this CommandBuffer to cleanup any generated data |
Operators
GreaterThan(ScriptableRenderPass, ScriptableRenderPass)
Declaration
public static bool operator>(ScriptableRenderPass lhs, ScriptableRenderPass rhs)
Parameters
| Type | Name | Description |
|---|---|---|
| ScriptableRenderPass | lhs | |
| ScriptableRenderPass | rhs |
Returns
| Type | Description |
|---|---|
| Boolean |
LessThan(ScriptableRenderPass, ScriptableRenderPass)
Declaration
public static bool operator <(ScriptableRenderPass lhs, ScriptableRenderPass rhs)
Parameters
| Type | Name | Description |
|---|---|---|
| ScriptableRenderPass | lhs | |
| ScriptableRenderPass | rhs |
Returns
| Type | Description |
|---|---|
| Boolean |