mathe/Library/PackageCache/com.unity.shadergraph@14.0.8/Documentation~/surface-options.md
2024-09-20 20:30:10 +02:00

6.3 KiB
Raw Blame History

Modify surface options without changing your graph

Description

Enable Allow Material Override to modify a specific set of properties for Universal Render Pipeline Lit and Unlit Shader Graphs and for Built-In Render Pipeline Shader Graphs in the Material Inspector.

PropertyURP LitURP UnlitBuilt-In Render Pipeline
Workflow ModeSee the URP documentation for the Lit URP Shader.Not applicable.Not applicable.
Receive Shadows
Cast ShadowsThis property is only exposed if Allow Material Override is enabled for this Shader Graph. Enable this property to make it possible for a GameObject using this shader to cast shadows onto itself and other GameObjects. This corresponds to the SubShader Tag ForceNoShadowCasting.Not applicable.
Surface TypeSee the URP documentation for the Lit and Unlit Shaders.In the Built-In Render Pipeline, this feature has the same behavior as in URP. Consult the URP documentation.
Render FaceIn the Built-In Render Pipeline, this feature has the same behavior as in URP. Consult the URP documentation.
Alpha ClippingIn the Built-In Render Pipeline, this feature has the same behavior as in URP. Consult the URP documentation.
Depth Write This property is only exposed if Allow Material Override is enabled for this Shader Graph.
Use this property to determine whether the GPU writes pixels to the depth buffer when it uses this shader to render geometry.

Options:
  • Auto (default): Unity writes pixels to the depth buffer for opaque materials, but not for transparent materials.
  • Force Enabled Unity always writes pixels to the depth buffer.
  • Force Disabled Unity never writes pixels to the depth buffer.
This option's functionality corresponds to the command ZWrite in ShaderLab. To override this setting in a RenderStateBlock, set the depthState.
Depth TestThis property is only exposed if Allow Material Override is enabled for this Shader Graph.
Use this property to set the conditions under which pixels pass or fail depth testing. The GPU does not draw pixels that fail a depth test. If you choose anything other than LEqual (the default setting for this property), consider also changing the rendering order of this material.

Options:
  • LEqual (default): Unity draws the pixel, if its depth value is less than or equal to the value on the depth texture. Less: Unity draws pixels of the affected surface if their coordinates are less than the current depth buffer value.
  • Never: Unity never draws the pixels of the affected surface.
  • Less: Unity draws pixels of the affected surface if their coordinates are less than the current depth buffer value.
  • Greater: Unity draws pixels of the affected surface if their coordinates are greater than the current depth buffer value.
  • GEqual: Unity draws pixels of the affected surface if their coordinates are greater than or equal to the current depth buffer value.
  • Equal: Unity draws pixels of the affected surface if their coordinates are equal to the current depth buffer value.
  • NotEqual: Unity draws pixels of the affected surface if their coordinates are not the same as the current depth buffer value.
  • Always: Unity draws this surface to your screen regardless of its z-coordinate.
This option's functionality corresponds to the command ZTest in ShaderLab. To override this setting in a RenderStateBlock, set the depthState property.
Support VFX GraphThis property is only available if the Visual Effect Graph package is installed. Indicates whether this Shader Graph supports the Visual Effect Graph. If you enable this property, output contexts can use this Shader Graph to render particles. The internal setup that Shader Graph does to support visual effects happens when Unity imports the Shader Graph. This means that if you enable this property, but don't use the Shader Graph in a visual effect, there is no impact on performance. It only affects the Shader Graph import time.Not applicable.

How to use

To use the Material Override feature:

  1. Create a new graph in Shader Graph.
  2. Save this graph.
  3. Open the Graph Inspector.
  4. Set Active Targets to Universal or Built In.
  5. In the Graph Inspectors Universal or Built In section, enable Allow Material Override.
  6. Create or select a Material or GameObject which uses your Shader Graph.
  7. In the Material Inspector, modify Surface Options for the target Material or GameObject.