Class ScriptableRenderer | Package Manager UI website
docs.unity3d.com
    Show / Hide Table of Contents

    Class ScriptableRenderer

    Class ScriptableRenderer implements a rendering strategy. It describes how culling and lighting works and the effects supported.

    A renderer can be used for all cameras or be overridden on a per-camera basis. It will implement light culling and setup and describe a list of ScriptableRenderPass to execute in a frame. The renderer can be extended to support more effect with additional ScriptableRendererFeature. Resources for the renderer are serialized in ScriptableRendererData.

    he renderer resources are serialized in ScriptableRendererData. ScriptableRendererData ScriptableRendererFeature ScriptableRenderPass

    Inheritance
    System.Object
    ScriptableRenderer
    Namespace: UnityEngine.Rendering.Universal
    Syntax
    public abstract class ScriptableRenderer

    Constructors

    ScriptableRenderer(ScriptableRendererData)

    Declaration
    public ScriptableRenderer(ScriptableRendererData data)
    Parameters
    Type Name Description
    ScriptableRendererData data

    Properties

    activeRenderPassQueue

    Declaration
    protected List<ScriptableRenderPass> activeRenderPassQueue { get; }
    Property Value
    Type Description
    System.Collections.Generic.List<ScriptableRenderPass>

    cameraColorTarget

    Declaration
    public RenderTargetIdentifier cameraColorTarget { get; }
    Property Value
    Type Description
    RenderTargetIdentifier

    cameraDepth

    Declaration
    public RenderTargetIdentifier cameraDepth { get; }
    Property Value
    Type Description
    RenderTargetIdentifier

    rendererFeatures

    Declaration
    protected List<ScriptableRendererFeature> rendererFeatures { get; }
    Property Value
    Type Description
    System.Collections.Generic.List<ScriptableRendererFeature>

    Methods

    ConfigureCameraTarget(RenderTargetIdentifier, RenderTargetIdentifier)

    Configures the camera target.

    Declaration
    public void ConfigureCameraTarget(RenderTargetIdentifier colorTarget, RenderTargetIdentifier depthTarget)
    Parameters
    Type Name Description
    RenderTargetIdentifier colorTarget

    Camera color target. Pass BuiltinRenderTextureType.CameraTarget if rendering to backbuffer.

    RenderTargetIdentifier depthTarget

    Camera depth target. Pass BuiltinRenderTextureType.CameraTarget if color has depth or rendering to backbuffer.

    EnqueuePass(ScriptableRenderPass)

    Enqueues a render pass for execution.

    Declaration
    public void EnqueuePass(ScriptableRenderPass pass)
    Parameters
    Type Name Description
    ScriptableRenderPass pass

    Render pass to be enqueued.

    Execute(ScriptableRenderContext, ref RenderingData)

    Execute the enqueued render passes. This automatically handles editor and stereo rendering.

    Declaration
    public 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 render state information.

    FinishRendering(CommandBuffer)

    Called upon finishing camera rendering. You can release any resources created on setup here.

    Declaration
    public virtual void FinishRendering(CommandBuffer cmd)
    Parameters
    Type Name Description
    CommandBuffer cmd

    GetCameraClearFlag(CameraClearFlags)

    Returns a clear flag based on CameraClearFlags.

    Declaration
    protected static ClearFlag GetCameraClearFlag(CameraClearFlags cameraClearFlags)
    Parameters
    Type Name Description
    CameraClearFlags cameraClearFlags

    Camera clear flags.

    Returns
    Type Description
    ClearFlag

    A clear flag that tells if color and/or depth should be cleared.

    Setup(ScriptableRenderContext, ref RenderingData)

    Configures the render passes that will execute for this renderer. This method is called per-camera every frame.

    Declaration
    public abstract void Setup(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 render state information.

    See Also
    ScriptableRenderPass
    ScriptableRendererFeature

    SetupCullingParameters(ref ScriptableCullingParameters, ref CameraData)

    Override this method to configure the culling parameters for the renderer. You can use this to configure if lights should be culled per-object or the maximum shadow distance for example.

    Declaration
    public virtual void SetupCullingParameters(ref ScriptableCullingParameters cullingParameters, ref CameraData cameraData)
    Parameters
    Type Name Description
    ScriptableCullingParameters cullingParameters

    Use this to change culling parameters used by the render pipeline.

    CameraData cameraData

    Current render state information.

    SetupLights(ScriptableRenderContext, ref RenderingData)

    Override this method to implement the lighting setup for the renderer. You can use this to compute and upload light CBUFFER for example.

    Declaration
    public virtual void SetupLights(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 render state information.

    In This Article
    • Constructors
      • ScriptableRenderer(ScriptableRendererData)
    • Properties
      • activeRenderPassQueue
      • cameraColorTarget
      • cameraDepth
      • rendererFeatures
    • Methods
      • ConfigureCameraTarget(RenderTargetIdentifier, RenderTargetIdentifier)
      • EnqueuePass(ScriptableRenderPass)
      • Execute(ScriptableRenderContext, ref RenderingData)
      • FinishRendering(CommandBuffer)
      • GetCameraClearFlag(CameraClearFlags)
      • Setup(ScriptableRenderContext, ref RenderingData)
      • SetupCullingParameters(ref ScriptableCullingParameters, ref CameraData)
      • SetupLights(ScriptableRenderContext, ref RenderingData)
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023