Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


Terrain Lit shader graph reference for URP

Explore the properties and settings you can use to customize the default Terrain Lit shader graph.
Read time 4 minutesLast updated a month ago

Explore the properties and settings you can use to customize the default Terrain Lit shader graph in the Universal Render Pipeline (URP).

Terrain shader passes

Some properties might not work as expected, because the terrain system adds two additional shader passes when it generates a terrain shader. The passes are the following:
  • Basemap Gen, which renders the shader graph on a quad to create a low-resolution baked version. As a result, the Position and Normal (Tangent Space) values are 2D during this pass.
  • Basemap Rendering, which uses a built-in shader and the texture Basemap Gen generates. The Position Block has no affect on this pass.

Contexts

The default Vertex and Fragment Contexts contain the following Blocks. Which Blocks display might change depending on the graph settings.

Vertex Context

The default values are the values from the mesh.

Input

Type

Description

PositionVector3Sets the vertex position in object space.

Note: The vertex position has no effect on the Basemap Rendering pass.

Fragment Context

Input

Type

Description

Base ColorVector3Sets the base color of the material. The default is
Color.grey
.
Normal (Tangent Space)Vector3Sets a custom normal map to simulate bumps and grooves on the surface of the sprite. For more information, refer to Add normal map and mask textures to a sprite.
MetallicfloatSets how metallic the surface of your material is. The range is between 0 and 1. A higher value means the surface reflects the environment more, and its albedo color becomes less visible. A lower value means the albedo color is clearer, and reflections from the environment are visible on top of the surface color, rather than obscuring it. A value of 1 means the the surface color is entirely driven by reflections from the environment.
EmissionVector3Sets the color the material emits as a light source. The default is black. For more information, refer to Add light emission to a material
SmoothnessfloatSets the smoothness of the material. Every light ray that hits a smooth surface bounces off at predictable and consistent angles. For a perfectly smooth surface that reflects light like a mirror, set this to a value of 1. Less smooth surfaces reflect light over a wider range of angles, so the reflections have less detail and spread across the surface in a more diffused pattern.
Ambient OcclusionfloatSets how much ambient light reaches the surface, rather than being occluded. A value of 0 means the fragment is completely occluded and appears black. A value of 1 means the fragment is not occluded at all, and the ambient color does not change.
AlphaFloatSets the alpha of the material. The range is 0 to 1. The default is 1.
Alpha Clip ThresholdFloatSets the minimum alpha value for a pixel to be visible. The range is 0 to 1. The default is 0.5. This property is only available if you enable Alpha Clipping in the graph settings.

Graph Settings

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

Setting

Description

Depth WriteDetermines whether the shader writes depth information to the depth buffer. The options are:
  • Auto: Sets opaque objects to write to the depth buffer, and transparent objects to not write to the depth buffer.
  • Force Enabled: Enables all objects from writing to the depth buffer.
  • Force Disabled: Disables all objects from writing to the depth buffer.
Depth TestSets the conditions under which geometry passes or fails depth testing. The GPU doesn't draw pixels that fail a depth test. For more information, refer to Control material properties in the Inspector window.
Alpha ClippingDiscards pixels if their alpha value is lower than a threshold value. Enabling this setting adds the Alpha Clip Threshold Block to the Fragment context. To access the holes texture from the Terrain Texture Node, you must enable this property.
Cast ShadowsEnables the terrain casting shadows onto itself and other GameObjects.
Receive ShadowsEnables the terrain receiving shadows from other GameObjects.
Fragment Normal SpaceSpecifies the normal map space that this material uses. The options are:
  • TangentSpace: Defines the normals in tangent space. Use this to tile a texture on a mesh.
  • ObjectSpace: Defines the normals in object space. Use this for planar-mapping GameObjects like the terrain.
  • WorldSpace: Defines the normal maps in world space.
Custom Editor GUIRenders a custom editor GUI in the Inspector window of the material. Enter the name of the GUI class in the field.

Additional resources