docs.unity3d.com
Search Results for

    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.

    The renderer resources are serialized in ScriptableRendererData. ScriptableRendererData ScriptableRendererFeature ScriptableRenderPass

    Inheritance
    object
    ScriptableRenderer
    UniversalRenderer
    Implements
    IDisposable
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: UnityEngine.Rendering.Universal
    Assembly: Unity.RenderPipelines.Universal.Runtime.dll
    Syntax
    public abstract class ScriptableRenderer : IDisposable

    Constructors

    ScriptableRenderer(ScriptableRendererData)

    Creates a new ScriptableRenderer instance.

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

    The ScriptableRendererData data to initialize the renderer.

    See Also
    ScriptableRendererData

    Fields

    k_CameraTarget

    The RTHandle for the Camera Target.

    Declaration
    protected static readonly RTHandle k_CameraTarget
    Field Value
    Type Description
    RTHandle

    Properties

    activeRenderPassQueue

    Returns a list of render passes scheduled to be executed by this renderer. ScriptableRenderPass

    Declaration
    protected List<ScriptableRenderPass> activeRenderPassQueue { get; }
    Property Value
    Type Description
    List<ScriptableRenderPass>

    cameraColorTargetHandle

    Returns the camera color target for this renderer. It's only valid to call cameraColorTarget in the scope of ScriptableRenderPass. ScriptableRenderPass.

    Declaration
    public RTHandle cameraColorTargetHandle { get; }
    Property Value
    Type Description
    RTHandle

    cameraDepthTargetHandle

    Returns the camera depth target for this renderer. It's only valid to call cameraDepthTarget in the scope of ScriptableRenderPass. ScriptableRenderPass.

    Declaration
    public RTHandle cameraDepthTargetHandle { get; }
    Property Value
    Type Description
    RTHandle

    profilingExecute

    Override to provide a custom profiling name

    Declaration
    protected ProfilingSampler profilingExecute { get; set; }
    Property Value
    Type Description
    ProfilingSampler

    rendererFeatures

    Returns a list of renderer features added to this renderer. ScriptableRendererFeature

    Declaration
    protected List<ScriptableRendererFeature> rendererFeatures { get; }
    Property Value
    Type Description
    List<ScriptableRendererFeature>

    supportedRenderingFeatures

    Supported rendering features by this renderer. SupportedRenderingFeatures

    Declaration
    public ScriptableRenderer.RenderingFeatures supportedRenderingFeatures { get; set; }
    Property Value
    Type Description
    ScriptableRenderer.RenderingFeatures

    unsupportedGraphicsDeviceTypes

    List of unsupported Graphics APIs for this renderer. unsupportedGraphicsDeviceTypes

    Declaration
    public GraphicsDeviceType[] unsupportedGraphicsDeviceTypes { get; set; }
    Property Value
    Type Description
    GraphicsDeviceType[]

    Methods

    ConfigureCameraTarget(RTHandle, RTHandle)

    Configures the camera target.

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

    Camera color target. Pass k_CameraTarget if rendering to backbuffer.

    RTHandle depthTarget

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

    Dispose()

    Disposable pattern implementation. Cleans up resources used by the renderer.

    Declaration
    public void Dispose()

    Dispose(bool)

    Called by Dispose(). Override this function to clean up resources in your renderer. Be sure to call this base dispose in your overridden function to free resources allocated by the base.

    Declaration
    protected virtual void Dispose(bool disposing)
    Parameters
    Type Name Description
    bool disposing

    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 rendering the camera stack. You can release any resources created by the renderer here.

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

    GetCameraClearFlag(ref CameraData)

    Returns a clear flag based on CameraClearFlags.

    Declaration
    protected static ClearFlag GetCameraClearFlag(ref CameraData cameraData)
    Parameters
    Type Name Description
    CameraData cameraData

    The Camera data.

    Returns
    Type Description
    ClearFlag

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

    See Also
    CameraData

    SetCameraMatrices(CommandBuffer, ref CameraData, bool)

    Set camera matrices. This method will set UNITY_MATRIX_V, UNITY_MATRIX_P, UNITY_MATRIX_VP to camera matrices. Additionally this will also set unity_CameraProjection and unity_CameraProjection. If setInverseMatrices is set to true this function will also set UNITY_MATRIX_I_V and UNITY_MATRIX_I_VP. This function has no effect when rendering in stereo. When in stereo rendering you cannot override camera matrices. If you need to set general purpose view and projection matrices call SetViewAndProjectionMatrices(CommandBuffer, Matrix4x4, Matrix4x4, bool) instead.

    Declaration
    public static void SetCameraMatrices(CommandBuffer cmd, ref CameraData cameraData, bool setInverseMatrices)
    Parameters
    Type Name Description
    CommandBuffer cmd

    CommandBuffer to submit data to GPU.

    CameraData cameraData

    CameraData containing camera matrices information.

    bool setInverseMatrices

    Set this to true if you also need to set inverse camera matrices.

    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.

    SetupRenderPasses(in RenderingData)

    Calls Setup for each feature added to this renderer. SetupRenderPasses(ScriptableRenderer, in RenderingData)

    Declaration
    protected void SetupRenderPasses(in RenderingData renderingData)
    Parameters
    Type Name Description
    RenderingData renderingData

    SupportedCameraStackingTypes()

    This setting controls if the camera editor should display the camera stack category. If your renderer is not supporting stacking this one should return 0. For the UI to show the Camera Stack widget this must support CameraRenderType.Base. CameraRenderType Returns the bitmask of the supported camera render types in the renderer's current state.

    Declaration
    public virtual int SupportedCameraStackingTypes()
    Returns
    Type Description
    int

    The bitmask of the supported camera render types in the renderer's current state.

    SupportsCameraStackingType(CameraRenderType)

    Returns true if the given camera render type is supported in the renderer's current state.

    Declaration
    public bool SupportsCameraStackingType(CameraRenderType cameraRenderType)
    Parameters
    Type Name Description
    CameraRenderType cameraRenderType

    The camera render type that is checked if supported.

    Returns
    Type Description
    bool

    True if the given camera render type is supported in the renderer's current state.

    Implements

    IDisposable

    Did you find this page useful? Please give it a rating:

    Thanks for rating this page!

    Report a problem on this page

    What kind of problem would you like to report?

    • This page needs code samples
    • Code samples do not work
    • Information is missing
    • Information is incorrect
    • Information is unclear or confusing
    • There is a spelling/grammar error on this page
    • Something else

    Thanks for letting us know! This page has been marked for review based on your feedback.

    If you have time, you can provide more information to help us fix the problem faster.

    Provide more information

    You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:

    You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:

    You've told us there is information missing from this page. Please tell us more about what's missing:

    You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:

    You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:

    You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:

    You've told us this page has a problem. Please tell us more about what's wrong:

    Thank you for helping to make the Unity documentation better!

    Your feedback has been submitted as a ticket for our documentation team to review.

    We are not able to reply to every ticket submitted.

    In This Article
    • Constructors
      • ScriptableRenderer(ScriptableRendererData)
    • Fields
      • k_CameraTarget
    • Properties
      • activeRenderPassQueue
      • cameraColorTargetHandle
      • cameraDepthTargetHandle
      • profilingExecute
      • rendererFeatures
      • supportedRenderingFeatures
      • unsupportedGraphicsDeviceTypes
    • Methods
      • ConfigureCameraTarget(RTHandle, RTHandle)
      • Dispose()
      • Dispose(bool)
      • EnqueuePass(ScriptableRenderPass)
      • Execute(ScriptableRenderContext, ref RenderingData)
      • FinishRendering(CommandBuffer)
      • GetCameraClearFlag(ref CameraData)
      • SetCameraMatrices(CommandBuffer, ref CameraData, bool)
      • Setup(ScriptableRenderContext, ref RenderingData)
      • SetupCullingParameters(ref ScriptableCullingParameters, ref CameraData)
      • SetupLights(ScriptableRenderContext, ref RenderingData)
      • SetupRenderPasses(in RenderingData)
      • SupportedCameraStackingTypes()
      • SupportsCameraStackingType(CameraRenderType)
    • Implements
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)