Unlit shader graph reference for URP
Explore the properties and settings you can use to customize the default Unlit shader graph.
阅读时间10 分钟最后更新于 9 天前
Explore the properties and settings you can use to customize the default Unlit shader graph in the Universal Render Pipeline (URP).
Contexts
The default Vertex and Fragment Contexts contain the following Blocks. Which Blocks display might change depending on the graph settings.
Vertex Context
Input | Type | Description |
|---|---|---|
| Position | Vector3 | Sets the vertex position in object space. |
| Normal | Vector3 | Sets the normal of the vertex in object space. |
| Tangent | Vector3 | Sets the tangent of the vertex in object space. |
| Motion Vector | Vector3 | Sets the per‑vertex motion vector in object space. This property is available only if you set Additional Motion Vector to Custom in graph settings. |
Fragment Context
Input | Type | Description |
|---|---|---|
| Base Color | Vector3 | Sets the base color of the material. The default is |
| Alpha | Float | Sets the alpha of the material. The range is 0 to 1. The default is 1. This property is available only if you set Surface Type to Transparent or you enable Alpha Clipping in graph settings. |
| Alpha Clip Threshold | Float | Sets the minimum alpha value for a pixel to be visible. The range is 0 to 1. The default is 0.5. This property is available only if you enable Alpha Clipping in the graph settings. |
Graph Settings
Explore the shader graph settings you can use to customize the Vertex and Fragment Contexts.
For more details about graph settings that are common to all shader graph shaders, refer to the Graph Settings tab.
Setting | Description |
|---|---|
| Allow Material Override | Enables material instances to override properties exposed in the shader graph. When disabled, materials using this shader will always use the values defined in the shader asset. |
| Write Color | Determines whether the shader writes color output. When disabled, the shader doesn't write color but can still write to the depth and stencil buffers. Unity removes the Base Color Block from the Fragment Context, doesn't generate a G-buffer pass, and hides settings that affect only color output, including Surface Type, Blending Mode, Additional Motion Vectors, Alembic Motion Vectors, Keep Lighting Variants, Default Decal Blending, and Default SSAO. This property is enabled by default. |
| Surface Type | Determines if the material supports transparency. The options are:
|
| Blending Mode | Sets how the shader blends the color of a transparent material with the background. This property is available only when you set Surface Type to Transparent. The options are:
|
| Render Face | Specifies which faces of the mesh the shader renders. The options are:
|
| Override Depth | Determines whether the shader uses custom depth write and depth test settings instead of the defaults. When disabled, the shader uses the default settings for the Surface Type: opaque surfaces write to the depth buffer and transparent surfaces don't, and both use the default depth test, L Equal, which passes when a pixel's depth is less than or equal to the stored depth. For the settings available when you enable this property, refer to Depth override settings. |
| Override Stencil | Determines whether the shader uses custom stencil settings instead of the URP defaults. For the settings available when you enable this property, refer to Stencil override settings. For more information, refer to ShaderLab: Stencil. |
| Override Passes | Sets which shader passes use the depth and stencil overrides. The options are:
|
| Alpha Clipping | Discards pixels if their alpha value is lower than a threshold value. When you enable this setting, Unity adds the Alpha Clip Threshold Block to the Fragment context. Avoid using this setting when Alpha and Alpha Clip Threshold are constant for the entire material, as it can cause visual artifacts and unnecessary MSAA performance overhead. |
| Cast Shadows | Determines whether the material casts shadows onto other objects. |
| Supports LOD Cross Fade | Enables level of detail (LOD) cross‑fading when the Mesh Renderer has a LOD Group component with Fade Mode set to Cross Fade. |
| Additional Motion Vectors | Controls how Unity generates motion vectors for this material, for motion blur and temporal anti‑aliasing. The options are:
|
| Alembic Motion Vectors | Enables motion vector support for meshes streamed through Alembic files. For more information, refer to Built-in shader support for motion vectors in URP. |
| Keep Lighting Variants | Adds the lighting keywords in the shader, even though it's Unlit. Enable this property to create custom lighting and call URP lighting functions in Custom Function nodes without manually adding and managing shader keywords. This property is applicable only when you use the Forward or Forward+ rendering path. |
| Default Decal Blending | Performs decal blending automatically. When disabled, you can implement decal blending directly in the shader graph to customize its behavior or allow decals to receive lighting from custom lighting implementations. This property is applicable only when you use the Forward or Forward+ rendering path. |
| Default SSAO | Applies Screen Space Ambient Occlusion (SSAO) automatically by sampling the pre‑rendered SSAO texture. When disabled, you can implement SSAO manually in the shader graph and customize its functionality. This property is applicable only when you use the Forward or Forward+ rendering path. |
| Custom Editor GUI | Renders a custom editor GUI in the Inspector window of the material. Enter the name of the GUI class in the field. For more information, refer to Control material properties in the Inspector window. |
Depth override settings
When you enable Override Depth, the following settings are available.
Setting | Description |
|---|---|
| Write Depth | Determines whether the shader writes depth values to the depth buffer. When you enable Override Depth, this property is enabled by default for opaque surfaces and disabled for transparent surfaces. |
| Depth Test | Specifies the comparison function used to determine whether a pixel passes the depth test. The options are:
|
Stencil override settings
When you enable Override Stencil, the following settings are available. If you set Render Face to Both, the Compare Function, Pass, Fail, and Z Fail properties appear under both Front Face and Back Face, so you can set a separate value for each face.
Setting | Description |
|---|---|
| Stencil Ref | Sets the reference value to compare against the value in the stencil buffer. Unity writes this value to the stencil buffer if a stencil operation is set to Replace. The range is 0 to 15, and the default is 0. URP reserves the upper four bits of the stencil buffer. |
| Read Mask | Sets the bitmask that Unity applies to the reference value and the stencil buffer value before the stencil test. The range is 0 to 15, and the default is 15. |
| Write Mask | Sets the bitmask that defines which bits of the stencil buffer Unity writes to. The range is 0 to 15, and the default is 15. |
| Compare Function | Compares the value in Stencil Ref with the value in the stencil buffer for each pixel. The options are:
|
| Pass | Sets the operation to perform on the stencil buffer value when a pixel passes both the stencil test and the depth test. The options are:
|
| Fail | Sets the operation to perform on the stencil buffer value when the stencil test fails. The options are:
|
| Z Fail | Sets the operation to perform on the stencil buffer value when the stencil test passes but the depth test fails. The options are:
|
Additional resources
- Get started with Shader Graph on Unity Learn
- Introduction to motion vectors