Understanding Unity Rendering Paths
This memo summarizes the rendering paths built into Unity, focusing on Forward Rendering and Deferred Rendering so you can pick the right mode when configuring Project Settings or writing shaders.
Most projects stick to one primary path and override specific cameras when needed.
1. Forward Rendering
Basics
For each object Unity draws:
- Renders the geometry
- Updates both the color buffer and depth buffer
- Repeats the fragment work for every pixel light affecting that object
- Pixel lights run in the fragment stage
- Vertex lights run in the vertex stage
Typical rules:
- Directional lights and lights tagged Important become per-pixel
- Lights tagged Not Important are treated per-vertex or via SH
- If the number of per-pixel lights is lower than the Quality Settings cap, Unity may promote more lights to per-pixel
LightMode tags & pass structure
Set LightMode inside a pass:
Tags { "LightMode" = "ForwardBase" }
Forward shaders usually include:
-
Base Pass (ForwardBase)
Handles one per-pixel directional light plus all per-vertex and SH lights. It also writes lightmaps, ambient, emission, and typically the shadow from the main directional light. -
Additional Pass (ForwardAdd)
Each per-pixel additional light becomes one pass. Shadows are off by default; add#pragma multi_compile_fwadd_fullshadowsif you need them.
Additional passes commonly use additive blending:
Blend One One
Pros / Cons
Pros
- Straightforward, works on most hardware
- Great transparency support
- Lower GPU requirements
Cons
- Cost grows roughly with
N_objects × M_pixelLights - Heavy scenes with many pixel lights explode in draw calls
2. Deferred Rendering
Principle
Deferred rendering relies on a G-buffer:
- Geometry Pass – write albedo, specular, smoothness, normals, emission, depth… for visible pixels
- Lighting Pass – evaluate lighting per screen pixel using the G-buffer data
Unity’s built-in pipeline uses the Standard lighting model inside Internal-DeferredShading.shader. Replace it if you need custom shading.
Pros / Cons
Pros
- Cost barely changes with the number of lights—mostly bounded by resolution and G-buffer size
- Ideal for scenes with many dynamic lights
Cons
- Traditional MSAA doesn’t work
- Poor support for transparency; transparent objects need separate forward passes
- Requires higher-end GPUs (mobile/low-end may struggle)
3. Choosing a path
Rough guidelines:
-
Forward
- Light count is moderate
- Heavy transparency / layered materials
- Targeting mid/low-end hardware
-
Deferred
- Large 3D scenes with many lights
- PC / console focus
- Transparency is limited or handled elsewhere
You can mix them: set a global path in Project Settings, then override specific cameras for special effects.
Original article (Chinese) on CSDN “uniGame”, CC BY-SA 4.0.
https://blog.csdn.net/alla_Candy/article/details/121443263