Distance Fade
Distance Fade blends the material toward a color, or makes it transparent, when the viewer gets close. It is mostly used to stop the camera from looking inside your own avatar's head or body, and to make hair or clothes fade instead of clipping when someone's face is right up against them.
The distance is measured from the viewer's head (in VR, the point between the two eyes), in meters. The fade is applied after lighting, so a faded surface shows the fade color exactly. Additional point and spot lights fade to nothing over the same range. This section is not available for the Gem shader.
Distance Fade#
Color#
_DistanceFadeColor HDR color · default black (0, 0, 0, 1)
The color the surface turns into when fully faded. In the Opaque and Cutout rendering modes only the RGB part is used (except with Dither, see below). In Transparent modes the alpha matters too: the surface's opacity is multiplied by it, so alpha 0 makes the surface fade out completely instead of turning into a color.
Start Distance#
_DistanceFade.x meters · default 0.1
The distance at which the fade begins. Farther than this, the surface looks normal.
End Distance#
_DistanceFade.y meters · default 0.01
The distance at which the fade is complete. Between Start and End the surface blends gradually. End is normally smaller than Start (fade as the viewer comes closer); if you set it larger, the effect is reversed and the surface fades as the viewer moves away.
Strength#
_DistanceFade.z 0 – 1 · default 0
How strongly the fade is applied. At the default 0 the whole feature does nothing, so this is the value to raise to turn Distance Fade on. 1 gives a full fade at the End Distance.
Backface Force Shadow#
_DistanceFade.w on / off · default off
When on, back faces are always filled with the fade color at the given Strength, regardless of distance. This hides the inside of a mesh (for example the inside of the head when the camera clips into it) behind a flat color. Outlines and fur ignore this option.
Mode#
_DistanceFadeMode Vertex / Position · default Vertex
Vertex measures the distance to each point of the surface, so only the part close to the viewer fades. Position measures the distance to the object's origin (its pivot), so the whole mesh fades at once and evenly. Use Position when a partial fade looks patchy, for example on small accessories.
Rim Light#
An optional rim on the faded surface, so its silhouette stays readable instead of turning into a flat silhouette of the fade color.
Color#
_DistanceFadeRimColor HDR color · default (0, 0, 0, 0)
The rim color. It is multiplied by the surface's own color, so white keeps the original texture visible at the edges and other colors tint it.
Alpha#
_DistanceFadeRimColor.a 0 – 1 · default 0
The strength of the rim. At 0 (default) there is no rim and the faded surface is a flat color.
Fresnel Power#
_DistanceFadeRimFresnelPower 0.01 – 50 · default 5
How tight the rim is. Higher values keep it to the very edge of the silhouette; lower values spread it further over the surface.
For your own avatar's face and hair, a common setup is Start 0.1, End 0.01, Strength 1 with a dark color, which prevents the inside of the mesh from showing when the camera or another player's head gets very close. In a Transparent material, set the color's alpha to 0 to make the surface vanish instead.
In Cutout mode with Dither enabled, the color's alpha is also applied before the dither test, so a dithered Cutout material can fade out with alpha 0 as well. NekoToon keeps the Distance Fade code in a built avatar only when a material's Strength is not 0 or an animation on the avatar animates _DistanceFade.