Skip to main content
TikTok Effect House Platform Logo
Download
Přihlásit se
Lighting and shadow

Shadows

Shadows require a directional light source and a model with material that supports shadow casting, so make sure you have these two components in your scene beforehand.

Shadows are only supported on the following materials:

Standard PBR material

Matcap (material capture) material

Simple lighting material

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

Enabling shadows for a light source

For your main light source (the one that will create shadows), you can enable shadows by clicking 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 some basic and advanced properties to tweak the shadows to your liking.

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

Changing this setting may increase the performance load of your effect!

  • Strength: This informs the darkness of your shadow.
  • Advanced settings:
    • Bias: The bias property shifts 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 phenomena called Peter Panning.
    • Shadow color: The color of your shadow (note: shadow color defaults to black)
    • Self gradient: Thisaids transition to a smooth surface by adding a value that helps counter jagged or hard edges
    • Soft shadow: This toggles whether or not your shadow is blurred at the edges.
Tip
Tip

Changing this setting may increase the performance load of your effect!

  • Softness: This affects how much your shadows are blurred at the edges
  • Auto frustrum (for Directional Lights only):This allows the engine to automatically determine the size of your light’s frustrum, or the portion that is visible on your screen (in most cases this is best). Think of your light source as a camera that is rendering the shadow map. If disabled, the user has to set the following properties:
    • 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, but each object’s shadow will take up a smaller part of the shadowmap, thus making them appear at a lower resolution
    • Frustum Near: The near plane of the light’s frustrum, used in calculating the shadowmap. 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 shadowmap. Set this to capture more objects farther away from the light, however if the frustum is too far they will disappear

Enabling shadows for mesh

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

Enabling shadow for material

Finally, toggle the Shadow on checkbox for your material (this property is enabled by default).

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