Skip to main content

Unity Playworks Plugin Real Time Shadows

Unity Playworks Plugin now supports Realtime Shadows!

The Playworks Plugin team have been working on implementing Real Time Shadows (RTS) to improve the visual experience and usability of playable builds generated with the Playworks Plugin for Unity.

Several games in the industry rely on RTS to improve the visual performance of their experiences, and our team aims to bring the same level of quality to playables.

On this page you can find out what features of Unity's Real Time Shadows Unity Playworks Plugin currently supports.

Feature details

Here are some examples of how Unity Playworks Plugin RTS can enhance your creative process.

Day and Night

images-medium

images-medium

Tanks!

images-medium

Viking Village

images-medium

Supported Features and Known Issues

The current RTS solution supports the following features:

  • One light source per scene.
  • Shadows from Directional Light are supported.
    • Point and Spot lights are not supported yet.
  • Stable Fit shadow projection is supported.
  • Hard and Soft shadows are supported.
  • Shadows are working only with the Built-in Rendering Pipeline.
  • Shadows are working in all Unity versions supported by Luna.
  • plugin RTS works with custom shadow-casting shader passes.
    • The shader pass should have LightMode set to ShadowCaster.

Supported settings

Lights

SettingSupportedDetails
Directional LightYes
Point LightNo
Spot LightNo
Multiple light sourcesNoOnly one light source is currently supported.

Shadow Settings in Quality Settings

Shadow Types

SettingSupportedDetails
No shadowsYes
Hard and Soft shadowsYes

Shadowmask Mode

SettingSupportedDetails
ShadowmaskYesOnly Shadowmask mode is currently supported.
Distance ShadowmaskNo

Shadow Resolution

SettingSupportedDetails
Low (512x512 px)Yes
Medium (1024x1024 px)Yes
High (2048x2048 px)Yes
Very High (4096x4096 px)YesVery High shadow resolution could not be supported on some devices due to the texture size used.

Shadow Projection

SettingSupportedDetails
Close FitNo
Stable FitYesOnly Stable Fit projection is currently supported.

Shadow Distance

SettingSupported
Shadow DistanceYes

Shadow Near Plane Offset

SettingSupportedDetails
Near Plane NoBoth global Near Plane setting (in Quality Settings) and individual Near Plane setting (in the Light component) are currently not supported.

Shadow Cascades

SettingSupported
No CascadesYes
2 CascadesYes
4 CascadesYes
Cascades SplitYes

Shadow Settings in Light Component

SettingSupportedDetails
No shadowsYes
Hard shadowsYes
Soft shadowsYes
StrengthYes
ResolutionYes
BiasYes
Normal BiasYes
Near PlaneNoBoth global Near Plane setting (in Quality Settings) and individual Near Plane setting (in the Light component) are currently not supported.

Shadow Settings in Unity Playworks Plugin Window

SettingSupportedDetails
Realtime ShadowsYesThis setting is used to rapidly disable shadows for the whole project without editing existing shadow settings in Light components and Quality Settings.

Shadow Settings in Mesh Renderer

SettingSupported
Cast ShadowYes
Receive ShadowsYes

Unity versions support

All Unity versions supported by Unity Playworks Plugin are compatible with Realtime Shadows.

User Guide

Follow these step to implement Shadows in any of your projects:

  1. Open your Unity project and import the Unity Playworks Plugin.
  2. Create or open a scene.
  3. Add a Directional Light to the scene:
    1. Ensure that Shadows Casting is enabled in the Light component.
    2. Select Hard Shadows or Soft Shadows option in Shadow Type property.
  4. Add an a shadow casters (e.g. cube) to the scene:
    1. Ensure that Cast Shadows option is enabled in the Mesh Renderer component.
    2. Ensure that Receive Shadows option is enabled in the Mesh Renderer component.
  5. Open the projects Quality Settings (Edit → Project Settings → Quality)
    1. Select Shadowmask option in Shadowmask Mode field.
    2. Select Hard or Hard and Soft shadows mode in Shadows field.
    3. Select any option in Shadow Resolution.
    4. Select Stable Fit option in Shadow Projection field.
    5. Select the desired Shadow Distance.
    6. Select any option in Shadow Cascades field (it is best to try the No cascades option first since it has the least impact on performance).
    7. Select desirable Cascade split if youve selected at least 2 cascades.
  6. Play with the shadow settings until you the wanted result.
  7. Open the Unity Playworks Plugin window and enable shadows:
    1. Check the Realtime Shadows option in Settings → Advanced → Realtime Shadows (see screenshot).
  8. Export Unity Playworks Plugin project and inspect the results.

images-large

Limitations and Performance Characteristics

A project with shadows enabled will perform slower than one without. Thats because each shadow-casting object that affects the final shadow image is rendered at least twice: once for shadow casting, and once for regular rendering. The number of draw-calls per caster is depending on the shadow settings (e.g. cascades count) and the number of passes for the regular mesh rendering.

Recommendations to lower hit on performance:

  • Reduce the number of shadowcasters (shadows that are visible to the camera)
  • Reduce the amount of cascades used (ideally No cascades).
  • Use a smaller shadow distance.
  • Lower the resolution of the shadows.
  • Use only Hard shadows.
Important

Shadows may negatively impact performance on some devices, or they may not work at all. This could be related to the device specific limitations (e.g. GPU memory). In order to resolve this issue, try lowering the shadow settings, and ensure that Unity's WebGL1 build on the device is able to render shadows.

Universal Render Pipeline Shadows

Universal Render Pipeline (URP) shadows are not currently supported.