Version: 2019.3
Scriptable Render Pipeline
Creating a custom Scriptable Render Pipeline

Scriptable Render Pipeline introduction

This page explains how the Scriptable Render Pipeline (SRP) works, and introduces some key concepts and terminology.

SRP is a thin API layer that lets you schedule and configure renderingThe process of drawing graphics to the screen (or to a render texture). By default, the main camera in Unity renders its view to the screen. More info
See in Glossary
commands using C# scriptsA piece of code that allows you to create your own Components, trigger game events, modify Component properties over time and respond to user input in any way you like. More info
See in Glossary
. SRP passes these commands to Unity’s low-level graphics architecture, which then sends instructions to the graphics API.

The Render Pipeline Asset and Render Pipeline Instance

When you write C# rendering code in SRP, you must create and customise two key elements:

  • A Render Pipeline Asset is an asset in your Unity Project that stores configuration data about your SRP. You define a Render Pipeline Asset by creating a script that inherits from Rendering.RenderPipelineAsset, and then you create and configure instances of the Render Pipeline Asset in your Project.
  • A Render Pipeline Instance is a class with a Render() method that is the entry point to SRP. To define a Render Pipeline Instance, you create a script that inherits from RenderPipeline.

For information about creating these elements, see Creating a Render Pipeline Asset and a Render Pipeline Instance.

The Scriptable Render Context

The Scriptable Render Context is a class that acts as an interface between your C# SRP code and Unity’s low-level graphics code. You schedule and execute rendering commands using the ScriptableRenderContext API.

For information about using the Scriptable Render Context, see Scheduling and executing rendering commands in the Scriptable Render Pipeline.

Entry points and callbacks

In SRP, you can write C# rendering code that Unity calls at specific times.

  • The Render() method of the Render Pipeline Instance is the entry point to the SRP. Unity calls this method once per frame for each CameraType that is currently rendering. Customize this method to customize your SRP.
  • The RenderPipelineManager class has four events: beginFrameRendering, beginCameraRendering, endCameraRendering, and endFrameRendering. You can subscribe to these events to execute code at specific points in the render pipeline. Note that if you are writing your own custom SRP, you must ensure that your SRP raises these events at appropriate times.
Scriptable Render Pipeline
Creating a custom Scriptable Render Pipeline
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961