Skip to content

ShadowGradientRenderData

16.20

Class Documentation

Edit documentation

The shadow gradient of a skin: it makes the shadow of the sun weaker on the upper part of a character. The client sends the three values to the character pixel shaders as the constant SHADOW_GRADIENT.

s      = shadow of the sun at the pixel, 0 (in shadow) to 1 (lit)
t      = smoothstep(GradientStart, GradientEnd, height)
shadow = s + t * (1 - s) * (1 - ShadowFactor)

height is the height of the vertex in the bind pose, as a fraction of the ModelHeight of the skin, limited to the range 0 to 1.

  • Below GradientStart the shadow is unchanged.
  • Above GradientEnd the darkness of the shadow is multiplied by ShadowFactor. With the default 0.3, a fully shadowed pixel gets 70% of the sun light.
  • Between the two heights the client blends smoothly.

The result is the shadow that the character sun light uses. The map rim light uses the same result through its SunShadowBlendWeight.

Where the value comes from. The class is a value inside the object that also holds RimOffset and ModelHeight. A skin refers to that object from SkinMeshDataProperties, and a material override of the skin can refer to its own. For each submesh the client uses the object of the submesh if there is one, and the object of the skin otherwise.

If neither exists, the client sends ShadowFactor 1, GradientStart 0 and GradientEnd 1, and the shadow is unchanged at every height. The defaults of this class (0.3, 0.65, 0.8) apply only to a skin that has the object.

Properties

GradientEnd

F32 = 0.800000011920929
Edit documentation

Height at which the shadow is weakest, as a fraction of ModelHeight.

GradientStart

F32 = 0.6499999761581421
Edit documentation

Height at which the shadow starts to weaken, as a fraction of ModelHeight.

ShadowFactor

F32 = 0.30000001192092896
Edit documentation

Part of the shadow darkness that remains above GradientEnd. 1 leaves the shadow unchanged at every height. 0 removes the shadow above GradientEnd.

Referenced by 1 class · 1 property