Skip to main content
TikTok Effect House Platform Logo
Latest
Download
Log in
Light and Shadow

Shadow

Before you begin, note that a Shadow requires a directional light source and a model with a material that supports shadow casting.

Shadows are only supported by the following materials:

The examples below show you how to cast the shadow of the target cube mesh and project the shadow onto the plane.

Enable Shadows for a Light Source

For your main light source that will create shadow, you can enable shadows by selecting the Cast shadow checkbox at the bottom of the Light properties.

Shadow Properties in Your Light Source

Once Shadows are enabled on your light source’s properties panel, you will have access to the following basic and advanced properties to adjust the shadows to your liking.

Resolution: The x and y resolution of your shadow map.

Tip
Tip

Changing the resolution may impact the performance of your effect.

Strength:Set the darkness of your shadow.

Advanced settings:

  • Bias: Shift pixels closer to the light source in your scene, helping combat shadow acne. The bias property should be used with caution, as too much bias will cause your shadows to “float away” – a phenomenon called Peter Panning.
  • Shadow color: The color of your shadow. Black is the default color.
  • Self gradient: Aid transition to a smooth surface by adding a value that helps counter jagged or hard edges.
  • Soft shadow: Control whether or not your shadow is blurred at the edges.
Tip
Tip

Enabling soft shadow may impact the performance of your effect.

Softness: This affects the blurriness of the edges of your shadows.

Auto frustrum (for Directional Lights only): Allow the engine to automatically determine the size of your light’s frustrum, or the portion that is visible on your screen. For most cases, enabling this property is best. If disabled, the following properties must be set:

  • Shadow Area: The size of the shadow map inside the scene. If the shadow map area is larger, it will include more objects within the scene. However, each object’s shadow will take up a smaller part of the shadow map, thus making them appear at a lower resolution.
  • Frustum Near:The near plane of the light’s frustrum used in calculating the shadow map. Use this to capture objects closer to the light, ensuring that they aren’t cut off.
  • Frustum Far:The far plane of the light’s frustum used in calculating the shadow map. Set this to capture more objects farther away from the light. If the frustum is too far, further objects will disappear.

Enable a Shadow for a Mesh

After enabling the shadow in your directional light, select the Cast shadow checkbox on your model.

Enable a Shadow for a Material

Finally, select the Shadow on checkbox for your material. This property is enabled by default.

You can now see a shadow being cast onto the model with shadows enabled!