URP Rendering Flow
A condensed summary of Unity’s official documentation on the Universal Render Pipeline flow—useful when reading URP source code or writing ScriptableRendererFeature.
Original doc: https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@8.1/manual/rendering-in-universalrp.html
URP renders a frame in five phases:
- Setup Culling Parameters
- Culling
- Build Rendering Data
- Setup Rendering
- Execute Renderer
1. Setup Culling Parameters
Goal: configure ScriptableCullingParameters.
- Which camera, FOV, near/far planes
- Layer masks for rendering / shadows
- Shadow distance, cascades, which lights cast shadows
- Quality or per-camera overrides
URP pulls data from Camera, UniversalAdditionalCameraData, QualitySettings, etc. Override hooks let you customize the parameters (e.g., render only certain layers).
2. Culling
With parameters prepared, URP culls the scene:
- Iterates renderers, lights, shadow casters
- Tests against frustum, layers, shadow settings
- Outputs a
CullingResults
CullingResults contains visible renderers, lights, and the data required for shadow maps. Good culling values reduce unnecessary work; e.g., shrinking shadow distance prevents faraway casters from consuming resources.
3. Build Rendering Data
URP combines:
CullingResults- URP Asset settings (rendering path, MSAA, shadow quality, additional light limits…)
- Camera settings (viewport, render scale, post-processing toggles…)
- Platform capabilities
The outcome is RenderingData, broken down into:
CameraDataLightDataShadowData- Other feature toggles
Think of it as the “contract” for the rest of the pipeline: what we render, how we render it, and with which quality.
4. Setup Rendering
Using RenderingData, URP builds the render pass queue:
- Creates built-in
ScriptableRenderPassinstances (depth prepass, main light, transparent rendering, post-processing, UI…) - Calls
EnqueuePassfor custom passes (fromScriptableRendererFeature) - Determines order based on dependencies
This stage is where most customization happens—you choose which passes run for each camera.
5. Execute Renderer
Finally URP executes the queued passes:
- Initialize render targets
- For each pass:
- Configure targets / clears
- Set viewport/scissor
- Issue
DrawRenderers,Blit, custom commands
- Output the final image to the camera target
Opening Frame Debugger shows this stage unrolled command by command.
Summary
URP frame loop:
- Prepare culling parameters
- Cull renderers/lights/shadows
- Build rendering data (camera/light/shadow info)
- Queue render passes
- Execute passes and present
Knowing these checkpoints helps when:
- Reading URP source
- Writing custom renderer features
- Tweaking URP Asset or camera settings
Original article (Chinese) on CSDN “uniGame”, CC BY-SA 4.0.
https://blog.csdn.net/alla_Candy/article/details/121559633