Class ScriptableRenderPass
ScriptableRenderPass implements a logical rendering pass that can be used to extend LWRP renderer.
Namespace: UnityEngine.Rendering.LWRP
Syntax
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 |
depthAttachment
Declaration
public RenderTargetIdentifier depthAttachment { get; }
Property Value
| Type | Description |
|---|---|
| RenderTargetIdentifier |
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
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
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 |
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 |
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)
Cleanup any allocated data that was created during the execution of the pass.
Declaration
public virtual void FrameCleanup(CommandBuffer cmd)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | cmd | Use this CommandBuffer to cleanup any generated data |
RenderPostProcessing(CommandBuffer, ref CameraData, RenderTextureDescriptor, RenderTargetIdentifier, RenderTargetIdentifier, Boolean, Boolean)
Adds a Render Post-processing command for execution. This changes the active render target in the ScriptableRenderer to destination.
Declaration
public void RenderPostProcessing(CommandBuffer cmd, ref CameraData cameraData, RenderTextureDescriptor sourceDescriptor, RenderTargetIdentifier source, RenderTargetIdentifier destination, bool opaqueOnly, bool flip)
Parameters
| Type | Name | Description |
|---|---|---|
| CommandBuffer | cmd | Command buffer to record command for execution. |
| CameraData | cameraData | Camera rendering data. |
| RenderTextureDescriptor | sourceDescriptor | Render texture descriptor for source. |
| RenderTargetIdentifier | source | Source texture or render target identifier. |
| RenderTargetIdentifier | destination | Destination texture or render target identifier. |
| Boolean | opaqueOnly | If true, only renders opaque post-processing effects. Otherwise, renders before and after stack post-processing effects. |
| Boolean | flip | If true, flips image vertically. |
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 |