文档

Unity Engine


User Manual

Script Reference

Unity Engine


Decal shader graph reference for URP

Explore the properties and settings you can use to customize the default Decal shader graph.
阅读时间3 分钟最后更新于 1 个月前

Explore the properties and settings you can use to customize the default Decal shader graph in the Universal Render Pipeline (URP).
You can assign a Material that uses a Decal Shader Graph to a GameObject directly. For example, you can use a Quad as the Decal GameObject.

Contexts

The default Fragment Context contains the following Blocks. Which Blocks display might change depending on the graph settings.

Fragment Context

Input

Type

Description

Base ColorVector3Sets the base color of the material. The default is
Color.grey
.
AlphaFloatSets the alpha of the material. The range is 0 to 1. The default is 1.
Normal (Tangent Space)Vector3Defines the normal of the material in tangent space.
Normal AlphaFloatDefines the mask that controls where the decal's normal displays.
MetallicFloatDefines the metallic value of the material, where 0 is non-metallic and 1 is metallic.
Ambient OcclusionFloatDefines the ambient occlusion of the material. Expected range 0 - 1.
SmoothnessFloatDefines the smoothness of the material. Expected range 0 - 1.
MAOS AlphaFloatDefines the mask that controls where the decal's metal, ambient occlusion, and smoothness display.

Graph Settings

Explore the shader graph settings you can use to customize the Fragment context.
For more details about graph settings that are common to all shader graph shaders, refer to Graph Settings tab.

Setting

Description

Affect BaseColorAffects the base color with the shader.
Most decals make use of this option.
An exception is a surface damage effect, where you might want to manipulate other properties, such as normals.
Affect NormalAffects normals with the shader. Use the Blend property to blend the normals of the decal with the normals of the surface it's projected to. If the Blend property is disabled, the decal overrides the normals all over the surface it's projected to.
Use case: add damage effects to materials, for example, bullet holes or cracks.
BlendBlends the normals of the decal with the normals of the surface it's projected to.
Affect MAOSOverrides the metallic, ambient occlusion, and smoothness (MAOS) of the surface with the Metallic, Ambient Occlusion, Smoothness, and MAOS Alpha values. For example:
  • Overrides smoothness to highlight puddles or wet paint.
  • Overrides metallic values with lower values to render rust.
  • Overrides ambient occlusion to give the decal more depth.
Affect EmissionAffects the emission values to make surfaces seem like they are emitting light, or to make surfaces seem like they are being lit by light.
Supports LOD Cross FadeAllow objects with LODs to cross fade from one LOD to the next without causing issues with decals, ensuring that decals applied to objects cross fading between LODs continue to display correctly.
Angle FadeFades out the effects of the decal at the specified surface normal angle. This prevents decals projected in 2D along a particular axis or direction from stretching. Otherwise, the object's surface deviates from the decal projection direction.
Custom Editor GUIRenders 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.

Additional resources