Skip to main content

Face SDF and Face SDF Studio

This page is for anyone turning on Enable Face SDF Shadow for the first time. It makes face shadows sweep like animation as the light rotates. It takes about 7 minutes.

What is this​

An SDF is an image that pre-draws the order in which face shadows move. As the light turns sideways, the area next to the nose is covered first, then the rest in order. The transition is far cleaner than using the face curvature directly.

A face with SDF off next to one with SDF on, with the light turned sideways

Tell these three apart first.

FeatureWhat it doesWhat it needs
Face Shading ModuleTreats the face area with different rules from the bodyA face mask or a proxy
Enable Face SDF ShadowControls the order of coverage by light directionA face SDF map
Face SDF StudioA separate add-on that makes mapsUnreleased. Not needed for this page

When to use it​

  • When you roam VRChat worlds and the lighting direction is unpredictable.
  • When you change the lighting direction during a Warudo broadcast.
  • When the nose shadow is fine from the front but falls apart from the side.

Try it in 30 seconds​

  1. Select the face material and turn on the Face Shading Module.
  2. Turn on Enable Face SDF Shadow.
  3. Put your prepared texture into Face SDF Map.
  4. Set Boundary Softness to 0.04.

You succeeded when the shadow sweeps in order as you turn the light left and right. If nothing changes, go to Troubleshooting.

Where do I get a map​

MingToon does not make maps for you. There are three routes.

RouteDescription
External productionDraw a front-facing grayscale face map yourself or commission one
Existing SDF-onlyBring a single-channel SDF made for another toon shader as it is
Face SDF StudioA separate unreleased add-on. Use the two routes above until it ships

SDF map formats​

Pick one of two methods in Map Format. The default is Packed RGBA.

FormatChannelsRecommended situation
Packed RGBAR is left, G is right, B is up, A is downThe default method that also uses vertical lighting
Single Channel Mirrored UOne R channel. The other side flips left and rightWhen bringing in an existing single-channel SDF

Single Channel Mirrored U does not use the vertical directions. Pick Packed RGBA if you also need vertical lighting changes.

Connecting your map in the Inspector​

  1. Turn on the Face Shading Module.
  2. Turn on Enable Face SDF Shadow.
  3. Pick Map Format to match your map.
  4. Assign the texture to Face SDF Map.
  5. Pick SDF Coordinates. If you did not prepare a UV7, it is Base Texture UV (Legacy).
  6. Adjust Horizontal Influence · Vertical Influence · SDF Shadow Amount.
  7. Set Boundary Offset and Boundary Softness under the actual avatar lighting.
The default for SDF Coordinates is Baked Front UV7

If you did not prepare front projection data along with the map, this value reads the wrong coordinates. Switch to Base Texture UV (Legacy) in that case.

Checking the four directions​

If the map directions are swapped, the shadow moves the wrong way. Move the light to four directions and check each one.

  1. Put the light to the left of the face. The right side must darken first.
  2. Put the light to the right of the face. The left side must darken first.
  3. Raise the light. Below the chin must darken first.
  4. Lower the light. The forehead must darken first.

Turning on SDF Test Preview ignores the lighting and shows the map itself in black and white. Maximum in Test Preview Channel shows the alignment of all four channels at once.

Values you will touch often​

Inspector labelWhat it changesSuggested starting valueRaise it / lower it
Boundary SoftnessThe width over which light crosses into shadowLeave at the default (0.04)Raising it softens, and lowering it too far exposes compression noise
Boundary OffsetThe point at which the shadow startsLeave at the default (0)Raising it darkens earlier, and lowering it darkens later
Horizontal InfluenceHow much it reacts to left and right lightingLeave at the default (1)At 0 the left-right change disappears
Vertical InfluenceHow much it reacts to up and down lightingLeave at the default (1)It is not used in the single-channel format
SDF Shadow AmountThe final strength of the dark SDF areaLeave at the default (1)At 0 the SDF shadow is hidden
Global Horizontal ScaleThe horizontal size of the mapLeave at the default (0.5)Use it to match the left-right width of the eyes and nose
SDF Mask IntensityHow far ears and the back of the head are excludedLeave at the default (1)At 0 the mask is ignored

Common problems​

Left and right move the wrong way​

Check the R and G layout of Packed RGBA. R is left and G is right. Also check that Face Forward (Object Space) matches the avatar.

The same face repeats like tiling​

The Wrap Mode of the map texture is Repeat. Change it to Clamp in the import settings.

I picked UV7 and the coordinates got tangled​

Only one thing can use UV7 on the same Renderer. If the face SDF uses UV7, the face normal bake skips that Renderer. If old data remains, run Release Baked Face Normals in MingToon Manager.

More detail​