Unity Products:Amplify Shader Editor/Depth Fade

From Amplify Creations Wiki
Jump to navigation Jump to search

Back to Node List

Depth Fade Node

The Depth Fade node outputs a linear gradient representing the distance between the surface of an object and geometry behind it. The gradient range or fading distance can be set by adjusting the Distance parameter.
More specifically what this parameter does is to create a value in a [0 1] range when the distance between the surface of an object and geometry behind it is within the value specified.
NOTE: The shader must have its Render Queue value set to Transparent or higher ( p.e. Blend Mode set either to Transparent or Translucent ) so the object is not written on the Depth buffer. This is an essential configuration since the node is internally calculating the distance value by subtracting the Surface Depth by the value fetched on the Depth buffer. If the object is being written on the depth buffer then this operation will give unintended results.



Nodes used: Float, Depth Fade

Node Parameter Description Default Value
Vertex Position Don't use this internal data as it's ignored internally. Only visible if the respective input port is not connected. 0
Distance Distance in world space coordinates to which the fade should take place. Only visible if the Dist input port is not connected. 1
Convert to Linear Convert depth values read from depth buffer from a logarithmic to a linear scale. True
Mirror Applies an Abs over the final value, guaranteeing the final value is always positive. True
Saturate Applies a Saturate over the final value, guaranteeing that the final value is on a 0 to 1 range. False


Input Port Description Type
Distance Distance in world space coordinates to which the fade should take place. Float
Vertex Position Allow the specification of a custom vertex position. Uses current vertex position if left unconnected. Float3

Back to Node List