StackLit
The StackLit Master Stack can render materials that are more complex than the Lit Master Stack. It includes all the features available in the Lit shader and, in some cases, provides more advanced or higher quality versions. For example, it uses a more advanced form of specular occlusion and also calculates anisotropic reflections for area lights in the same way the Lit shader does for other light types. It also takes into account light interactions between two vertically stacked physical layers, along with a more complex looking general base layer.
Creating a StackLit Shader Graph
To create a StackLit material in Shader Graph, you can either:
Modify an existing Shader Graph.
- Open the Shader Graph in the Shader Editor.
- In Graph Settings, select the HDRP Target. If there isn't one, go to Active Targets, click the Plus button, and select HDRP.
- In the Material drop-down, select StackLit.
Create a new Shader Graph.
- Go to Assets > Create >Shader Graph > HDRP and click StackLit Shader Graph.
Contexts
This Master Stack material type has its own set of Graph Settings. Because of the relationship between settings and Blocks, this has consequences on which Blocks are relevant to the Graph. This section contains information on the Blocks this Master Stack material type adds by default, and which Blocks set properties for this Master Stack material type's Graph Settings.
For more information about the relationship between Graph Settings and Blocks, see Contexts and Blocks.
Vertex Context
Default
When you create a new Hair Master Stack, the Vertex Context contains the following Blocks by default:
Property | Description | Setting Dependency | Default Value |
---|---|---|---|
Position | The object space vertex position per vertex. | None | CoordinateSpace.Object |
Normal | The object space vertex normal per vertex. | None | CoordinateSpace.Object |
Tangent | The object space vertex tangent per vertex. | None | CoordinateSpace.Object |
Relevant
This Master Stack material type adds all its Vertex Blocks to the Vertex Context by default and has no extra relevant Blocks.
Fragment Context
Default
When you create a new Hair Master Stack, the Fragment Context contains the following Blocks by default:
Property | Description | Setting Dependency | Default Value |
---|---|---|---|
Base Color | The base color of the material. | None | Color.grey |
Normal Tangent Space | The normal, in tangent space, for the material. | • Fragment Normal Space set to Tangent | CoordinateSpace.Tangent |
Bent Normal | The bent normal of the fragment. HDRP uses bent normal maps to simulate more accurate ambient occlusion. Bent normals only work with diffuse lighting. | • Material set to Eye, Fabric, Hair, Lit, or StackLit | CoordinateSpace.Tangent |
Tangent Tangent Space | The direction of anisotropy in tangent space. This stretches the specular highlights in the given direction. | • Material set to Lit • Material Type set to Anisotropy • Fragment Normal Space set to Tangent Or • Material set to StackLit • Fragment Normal Space set to Tangent Or • Material set to Fabric and Material Type set to Silk • Fragment Normal Space set to Tangent |
CoordinateSpace.Tangent |
Metallic | The material's metallic value. This defines how "metal-like" the surface of your Material is (between 0 and 1). When a surface is more metallic, it reflects the environment more and its albedo color becomes less visible. At full metallic level, the surface color is entirely driven by reflections from the environment. When a surface is less metallic, its albedo color is clearer and any surface reflections are visible on top of the surface color, rather than obscuring it. | None | 0.0 |
Dielectric IOR | The index of refraction that determines the specular color of the material when the metallic value is 0. | • Material set to StackLit • Base Color Parametrization set to Base Metallic |
1.5 |
Smoothness | The material's smoothness. 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 (because the light hits the bumps in the microsurface), so the reflections have less detail and spread across the surface in a more diffused pattern. | None | 0.5 |
Emission | The color of light to emit from this material's surface. Emissive materials appear as a source of light in your scene. | None | Color.black |
Ambient Occlusion | The material's ambient occlusion. This approximates occlusion for a fragment on a GameObject’s surface that has been cast by details present in the Material but not the mesh geometry. 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. | None | 1.0 |
Alpha | The Material's alpha value. This determines how transparent the material is. The expected range is 0 - 1. | None | 1.0 |
Relevant
Depending on the Graph Settings you use, Shader Graph can add the following Blocks to the Fragment Context:
Property | Description | Setting Dependency | Default Value |
---|---|---|---|
Alpha Clip Threshold | The alpha value limit that HDRP uses to determine whether to render each pixel. If the alpha value of the pixel is equal to or higher than the limit, HDRP renders the pixel. If the value is lower than the limit, HDRP does not render the pixel. The default value is 0.5. | • Alpha Clipping enabled | 0.5 |
Alpha Clip Threshold Depth Postpass | The alpha value limit that HDRP uses for the transparent depth postpass. If the alpha value of the pixel is equal to or higher than this limit, HDRP renders the pixel. If the value is lower than the limit, HDRP does not render the pixel. The default value is 0.5. | • Alpha Clipping enabled • Transparent Depth Postpass enabled |
0.5 |
Alpha Clip Threshold Depth Prepass | The alpha value limit that HDRP uses for the transparent depth prepass. If the alpha value of the pixel is equal to or higher than this limit, HDRP renders the pixel. If the value is lower than the limit, HDRP does not render the pixel. The default value is 0.5. | • Alpha Clipping enabled • Transparent Depth Prepass enabled |
0.5 |
Alpha Clip Threshold Shadow | The alpha value limit that HDRP uses to determine whether it should render shadows for a pixel. If the alpha value of the pixel is equal to or higher than this limit, HDRP renders the pixel. If the value is lower than the limit, HDRP does not render the pixel. The default value is 0.5. | • Use Shadow Threshold enabled | 0.5 |
Anisotropy | The direction of the anisotropy effect. Negative values make the effect vertical, and positive values make the effect horizontal. | • Anisotropy enabled | 0.0 |
Baked Back GI | The global illumination (GI) value to apply to the back face of the Mesh only. This replaces the built-in diffuse GI solution. This port only appears when you enable the Override Baked GI setting. |
• Override Baked GI enabled | 0.0 |
Baked GI | The global illumination (GI) value to apply to the front face of the Mesh only. This replaces the built-in diffuse GI solution. | • Override Baked GI enabled | 0.0 |
Coat Extinction | The HDR color that determines which color the coat absorbs the most. This property works with Coat Thickness to calculate an absorption coefficient. | • Material set to StackLit • Coat enabled |
Color.white |
Coat IOR | The index of refraction to use for the coating layer. | • Material set to StackLit • Coat enabled |
1.4 |
Coat Smoothness | The smoothness of the coat's specular lobe. The coat has no diffuse component, but this property affects the base layer's diffuse color. Decreasing this value also makes the base layer seem less smooth. | • Material set to StackLit • Coat enabled |
1.0 |
Coat Thickness | The intensity of the coat's absorption effect. This property works with Coat Extinction to calculate an absorption coefficient. A value of 0 produces no absorption and a value of 1 produces full absorption. | • Material set to StackLit • Coat enabled |
0.0 |
Coat Mask | The mask that simulates a clear coat effect on the Material to mimic materials like car paint or plastics. | • Material set to StackLit • Coat enabled |
0.0 |
Coat Normal Object Space | The normal, in object space, for the coat. | • Material set to StackLit • Coat enabled • Coat Normal enabled • Fragment Normal Space set to Object |
CoordinateSpace.Object |
Coat Normal Tangent Space | The normal, in tangent space, for the coat. | • Material set to StackLit • Coat enabled • Coat Normal enabled • Fragment Normal Space set to Tangent |
CoordinateSpace.Tangent |
Coat Normal World Space | The normal, in world space, for the coat. | • Material set to StackLit • Coat enabled • Coat Normal enabled • Fragment Normal Space set to World |
CoordinateSpace.World |
Depth Offset | The value that the Shader uses to increase the depth of the fragment by. This Block requires you to input the result of the Parallax Occlusion Mapping Node to produce a realistic result. | • Depth Offset enabled | 0.0 |
Diffusion Profile | The Diffusion Profile to use for subsurface scattering and transmission. | • Material Type set to Subsurface Scattering or Translucent | 0.0 |
Iridescence Coat Fixup TIR | Sets the amount to adjust the internal iridescence model by so that the total internal reflection (TIR) angle is always the grazing angle. This means that the TIR region is always out of view, regardless of the overall coat and iridescence thickness. | • Material Type set to StackLit • Iridescence enabled • Coat enabled. |
0.0 |
Iridescence Coat Fixup TIR Clamp | The value to clamp the color flip phase to. This is at the grazing angle endpoint of the angular range. This makes it so that the oscillations only “elongate” towards the 0 degree viewing angle, which makes a lowered thickness more apparent. | • Material Type set to StackLit • Iridescence enabled • Coat enabled. |
0.0 |
Iridescence Thickness | The thickness of the iridescence. This changes the gradient of color that the iridescence effect produces. | • Material Type set to StackLit • Iridescence enabled. |
0.0 |
Iridescence Mask | The strength of the iridescence effect. | • Material Type set to StackLit • Iridescence enabled. |
0.0 |
Haze Extent | The range of the haze or halo effect around the central specular highlight. | • Material set to StackLit • Duel Specular Lobe Parametrization set to Hazy Gloss |
3.0 |
Haziness | The intensity of the haze or halo effect. A value of 0 produces no haziness. A value of 1 produces the full haze effect. | • Material set to StackLit • Duel Specular Lobe Parametrization set to Hazy Gloss |
0.2 |
Hazy Gloss Max Dielectric F0 | The maximum intensity the specular highlight can be when Metallic is 0. As the metallic value increases, the maximum intensity relaxes towards 1. | • Material set to StackLit • Base Color Parametrization set to Base Metallic • Duel Specular Lobe Parametrization set to Hazy Gloss |
0.25 |
Lobe Mix | The amount of mixing between the primary and secondary specular lobes. | • Duel Specular Lobe enabled • Duel SpecularLobe Parametrization set to Direct. |
0.3 |
Normal Object Space | The normal, in object space, for the material. | • Fragment Normal Space set to Object | CoordinateSpace.Object |
Normal World Space | The normal, in world space, for the material. | • Fragment Normal Space set to World | CoordinateSpace.World |
Smoothness B | The smoothness of the second specular lobe. | • Material set to StackLit • Dual Specular Lobe enabled • Dual SpecularLobe Parametrization set to Direct. |
0.5 |
Specular AA Screen Space Variance | The strength of the geometric specular anti-aliasing effect between 0 and 1. Higher values produce a blurrier result with less aliasing. | • Specular AA enabled | 0.0 |
Specular AA Threshold | The maximum value that HDRP subtracts from the smoothness value to reduce artifacts. | • Specular AA enabled | 0.0 |
Specular Color | The material's specular color value. This defines the brightness and tint colour of specular highlights. | None | Color.grey |
Specular Occlusion | A multiplier for the intensity of specular global illumination. | • Specular Occlusion Mode set to Custom | 1.0 |
Subsurface Mask | The strength of the screen-space blur effect across the Material. | • Material set to Lit • Material Type set to Subsurface Scattering. |
1.0 |
Tangent Object Space | The direction of anisotropy in object space. This stretches the specular highlights in the given direction. | • Material set to Lit • Material Type set to Anisotropy • Fragment Normal Space set to Object Or • Material set to StackLit • Fragment Normal Space set to Object Or • Material set to Fabric and Material Type set to Silk • Fragment Normal Space set to Object |
CoordinateSpace.Object |
Tangent World Space | The direction of anisotropy in world space. This stretches the specular highlights in the given direction. | • Material set to Lit • Material Type set to Anisotropy • Fragment Normal Space set to World Or • Material set to StackLit • Fragment Normal Space set to World Or • Material set to Fabric and Material Type set to Silk • Fragment Normal Space set to World |
CoordinateSpace.World |
Thickness | The thickness of the surface that HDRP uses to evaluate transmission. | • Material Type set to Subsurface Scattering and Transmission enabled. Or • Material Type set to Transluscent. Or • Refraction Model not set to None |
1.0 |
Graph Settings
Surface Options
Property | Description |
---|---|
Surface Type | Specifies whether the material supports transparency or not. Materials with a Transparent Surface Type are more resource intensive to render than Materials with an Opaque Surface Type. Depending on the option you select, HDRP exposes more properties. The options are: • Opaque: • Transparent: Simulates a translucent Material that light can penetrate, such as clear plastic or glass. For more information about the feature and for the list of properties each Surface Type exposes, see the Surface Type documentation. |
- Rendering Pass | Specifies the rendering pass that HDRP processes this material in. • Before Refraction: Draws the GameObject before the refraction pass. This means that HDRP includes this Material when it processes refraction. To expose this option, select Transparent from the Surface Type drop-down. • Default: Draws the GameObject in the default opaque or transparent rendering pass pass, depending on the Surface Type. • Low Resolution: Draws the GameObject in half resolution after the Default pass. • After post-process: For Unlit Materials only. Draws the GameObject after all post-processing effects. |
- Blending Mode | Specifies the method HDRP uses to blend the color of each pixel of the material with the background pixels. The options are: • Alpha: Uses the Material’s alpha value to change how transparent an object is. 0 is fully transparent. 1 appears fully opaque, but the Material is still rendered during the Transparent render pass. This is useful for visuals that you want to be fully visible but to also fade over time, like clouds. • Additive: Adds the Material’s RGB values to the background color. The alpha channel of the Material modulates the intensity. A value of 0 adds nothing and a value of 1 adds 100% of the Material color to the background color. • Premultiply: Assumes that you have already multiplied the RGB values of the Material by the alpha channel. This gives better results than Alpha blending when filtering images or composing different layers. This property only appears if you set Surface Type to Transparent. |
- Receive Fog | Indicates whether fog affects the transparent surface. When disabled, HDRP does not take this material into account when it calculates the fog in the Scene. |
- Depth Test | Specifies the comparison function HDRP uses for the depth test. |
- Depth Write | Indicates whether HDRP writes depth values for GameObjects that use this material. |
- Cull Mode | Specifies the face to cull for GameObjects that use this material. The options are: • Front: Culls the front face of the mesh. • Back: Culls the back face of the mesh. This property only appears if you disable Double Sided. |
- Sorting Priority | Allows you to change the rendering order of overlaid transparent surfaces. For more information and an example of usage, see the Material sorting documentation. This property only appears if you set Surface Type to Transparent. |
- Back Then Front Rendering |
Indicates whether HDRP renders this material in two separate draw calls. HDRP renders the back face in the first draw call and the front face in the second. This property only appears if you set Surface Type to Transparent. |
- Transparent Depth Prepass | Indicates whether HDRP adds polygons from the transparent surface to the depth buffer to improve their sorting. HDRP performs this operation before the lighting pass and this process improves GPU performance. |
- Transparent Depth Postpass | Indicates whether HDRP adds polygons to the depth buffer that post-processing uses. HDRP performs this operation before the lighting pass. Enabling this feature is useful if you want to use post-processing effects that use depth information, like motion blur or depth of field. |
- Transparent Writes Motion Vectors | Indicates whether HDRP writes motion vectors for transparent GameObjects that use this Material. This allows HDRP to process effects like motion blur for transparent objects. For more information on motion vectors, see the motion vectors documentation. This property only appears if you set Surface Type to Transparent. |
- - Preserve Specular Lighting |
Indicates whether to make alpha blending not reduce the intensity of specular highlights. This preserves the specular elements on the transparent surface, such as sunbeams shining off glass or water. This property only appears if you set Surface Type to Transparent. |
Alpha Clipping |
Indicates whether this material acts like a Cutout Shader. For more information about the feature and for the list of properties this feature exposes, see the Alpha Clipping documentation. |
- Use Shadow Threshold |
Indicates whether HDRP uses another threshold value for alpha clipping shadows. This property only appears if you enable Alpha Clipping. |
- Alpha to Mask |
Indicates whether to turn on alpha-to-coverage. If your Project uses MSAA, alpha-to-coverage modifies the multi-sample coverage mask proportionally to the pixel shader result alpha value. This is typically used for anti-aliasing vegetation and other alpha-tested shaders. This property only appears if you enable Alpha Clipping. |
Double Sided Mode | Specifies how HDRP renders the faces of polygons in the mesh geometry. The options are: • Disabled: Only renders one face of the polygons. • Enabled: Renders both faces of the polygons. In this mode, the normal of the back face is the same as the front face. • Flipped Normals: Renders both faces of the polygons. In this mode, the normal of the back face is 180° of the front-facing normal. This also applies to the material, which means that it looks the same on both sides of the geometry. • Mirrored Normals: Renders both faces of the polygons. In this mode, the normal of the back face mirrors the front-facing normal. This also applies to the material, which means that it inverts on the back face. This is useful when you want to keep the same shape on both sides of the geometry, for example, for leaves. For more information about this feature, see Double-sided. |
Fragment Normal Space | Specifies the normal map space that this Material uses. • 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. |
Receive Decals | Indicates whether HDRP can draw decals on this material’s surface. |
Receive SSR/SSGI | Indicates whether HDRP includes this material when it processes the screen space reflection pass. HDRP also takes this material into account when it calculates screen space global illumination. This property only appears if you set Surface Type to Opaque. |
Receive SSR Transparent | Indicates whether HDRP includes this material when it processes the screen space reflection pass. This property only appears if you set Surface Type to Transparent. |
Geometric Specular AA | Indicates whether HDRP performs geometric anti-aliasing on this material. This modifies the smoothness values on the surfaces of curved geometry to remove specular artifacts. For more information about the feature and for the list of properties this feature exposes, see the Geometric Specular Anti-aliasing documentation. |
Depth Offset | Indicates whether HDRP modifies the depth buffer according to the displacement. This allows effects that use the depth buffer (Contact Shadows for example) to capture pixel displacement details. |
Base Color Parametrization | Specifies the method to set color and reflectance properties of the material. The options are: • Base Metallic: Applies the basic metallic Shader workflow to the material. In the StackLit shader, when Metallic is 0, Dielectric Ior determines the specular color of the base layer. • Specular Color: Applies the Specular Color workflow to the material. Use this to create Materials with a coloured specular highlight. This is similar to the built-in Specular Shader. |
Energy Conserving Specular | Indicates whether HDRP reduces the diffuse color of the Material if the specular effect is more intense. This makes the lighting of the Material more consistent and makes it look more physically accurate. This setting only appears when you set Base Color Parametrization to Specular Color. |
Anisotropy | Indicates whether to apply anisotropy to the material. If you enable Dual Specular Lobe the two lobes have independent anisotropic intensity values (Anisotropy and AnisotropyB). |
Coat | Indicates whether to apply a dielectric coating layer to the base layer. This is a complete covering that has no independent material lerping or mixing. The coat has an independent roughness, a configurable index of refraction, and an extinction/absorption effect with a configurable thickness. The coat layer is not anisotropic. |
Coat Normal | Indicates whether to use an independent normal for the coat layer. When enabled, the Coat Normal property sets the normals specifically for the coat layer. When disabled, the Normal property sets the normals for both the coat layer and the base layer. |
Dual Specular Lobe | Indicates whether to add a second specular lobe to the base layer to simulate hazy materials without using a coat. If you also enable anisotropy, each lobe has an independent, configurable, anisotropic smoothness. The two lobes that characterize the base surface layer use the same index of refraction, or specular color (depending on the Base Color Parametrization). The second lobe then further uses a different input configuration depending on the Dual Specular Lobe Parametrization. |
Dual Specular Lobe Parametrization | Specifies the method that controls the second specular lobe. The options are: • Direct: Gives you direct control of the second lobe. SmoothnessB controls the second lobe's smoothness, LobeMix controls the amount of mixing between the two lobes, and Anisotropy controls the second lobe's anisotropic smoothness. • Hazy Gloss: Adds a haze effect to the surface directly while keeping the primary lobe mostly unchanged. Haziness controls the intensity of the haze effect. HazeExtent controls the range of the haze around the central highlight. This option is the most intuitive and controllable way to use two lobes. Note that this mode implicitly modifies the specular color. If the material already has a high specular intensity (close to 1), there is no room to increase it in regions where haziness requires it to be boosted. In this case, haziness has little to no effect. This setting only has an effect if you enable Dual Specular Lobe. |
Cap Haziness For Non Metallic | Indicates whether to cap the intensity of the specular highlight for materials that have a metallic value of 0. As the metallic value increases, the cap relaxes towards 1. This setting only appears if you set Base Color Parametrization to Metallic and Dual Specular Lobe Parametrization to Hazy Gloss. |
Iridescence | Indicates whether to apply iridescence to the base layer (and the coat layer if there is one). Iridescent surfaces appear to gradually change color as the angle of view or the angle of illumination changes. |
- Transmission |
Indicates whether HDRP simulates the translucency of the material using a thickness map. Configure subsurface scattering and transmission settings using a Diffusion Profile. For more information, see documentation on Subsurface Scattering. This property only appears when you select Subsurface Scattering from the Material Type drop-down. |
Specular Occlusion Mode | The mode that HDRP uses to calculate specular occlusion. The options are: • Off: Disables specular occlusion. • Direct From AO: Calculates specular occlusion from the ambient occlusion map and the Camera's view vector. • SPTD Integration of Bent AO: First uses the bent normal with the ambient occlusion value to calculate a general visibility cone. Then, calculates the specular occlusion using a Spherical Pivot Transformed Distribution (SPTD) that is properly integrated against the bent visibility cone. • Custom: Allows you to specify your own specular occlusion values. |
Anisotropy For Area Lights | Indicates whether to calculate anisotropic reflections for area lights. Note that enabling this option makes a StackLit material more resource intensive to process around area lights. |
Base Layer Uses Refracted Angles | Indicates whether to shade directional, punctual, and spot lights on the bottom layer with refraction from the top layer (the coat). This setting only appears if you enable Coat. |
Recompute Stack And Iridescence | Indicates whether the StackLit shader simulates its coat/layer effect for each Light individually, rather than once for all Lights at the same time. Note this only applies to punctual, directional, and spot Lights. Enabling this option increases the resource intensity of the shader, so only use it when necessary (for example, when Honor Per Light Max Smoothness is enabled). |
Honor Per Light Max Smoothness | Indicates whether the StackLit shader uses the shape of directional, punctual, and spot Lights when it simulates the extent of the Lights. Depending on the smoothness values of the layers, enabling this option can produce unrealistic results for Lights that have large shapes. To fix this, enable Recompute Stack and Iridescence. These options are separate because recomputing the stack per Light instead of once for all Lights is significantly more resource intensive. |
Distortion
This set of settings only appears if you set Surface Type to Transparent.
Property | Description |
---|---|
Distortion | Indicates whether to distort light that passes through this transparent Material. |
Distortion Blend Mode | Specifies the mode that HDRP uses to blend overlaid distortion surfaces. The options are: • Add: Adds the output distortion value with the current distortion value in the pixel. This is the default mode. • Multiply: Multiplies the output distortion value with the current distortion value in the pixel. • Replace: Replaces the current distortion value in the pixel with the output distortion value. This setting only appears if you enable Distortion. |
Distortion Depth Test | Indicates whether GameObjects that are closer to the Camera hide the distortion effect. Disable this setting to make the distortion effect appear on top of the rendering. This setting only appears if you enable Distortion. |
Advanced Options
Property | Description |
---|---|
Specular Occlusion Mode | The mode that HDRP uses to calculate specular occlusion. The options are: • Off: Disables specular occlusion. • From AO: Calculates specular occlusion from the ambient occlusion map and the Camera's view vector. • From AO and Bent Normal: Calculates specular occlusion from the ambient occlusion map, the bent normal map, and the Camera's view vector. • Custom: Allows you to specify your own specular occlusion values. |
Override Baked GI | Indicates whether this Material ignores global illumination (GI) in the Scene and instead uses custom GI values. Enable this setting to add two baked GI Blocks to the Fragment Context that control GI for the Material. Disable this setting to make the Material use the Scene's GI. |
Support Lod Crossfade | Indicates whether HDRP processes dithering when a mesh moves moves from one LOD level to another. |
Add Precomputed Velocity | Indicates whether to use precomputed velocity information stored in an Alembic file. |