Planar Shadows v1.3.0
Overview
This solution implements planar shadows based on the URP framework.
Clean and lightweight, with minimal performance cost, suitable for mobile platforms.
Use Cases
Ideal for flat-ground environments, where planar shadows deliver strong visual results.
Well-suited for character showcase scenes, with gradients and stylization enhancing visual fidelity.
Useful for performance scaling: apply high-cost shadows on high-end devices, and PlanarShadows on low-end ones.
Shadow Types
Static Height Shadow
Renders all shadows at a fixed height, suitable for objects on the same horizontal plane.
Origin Height Shadow
Renders shadows at the model’s origin position, suitable for objects placed at different heights.
Root Height Shadow
Renders shadows at the root position of a composite object, suitable for complex objects at varying heights.
Raycast Ground Shadow
Detects ground height via raycast and renders shadows on the ground, suitable for characters jumping between platforms.
Visual Features
Supports configurable shadow color and transparency.
Supports non-stacking shadows — shadows will not overlap each other (fade gradient not supported in this mode).
Supports fade gradient — the farther the shadow is from the origin, the lighter its color becomes.
Supports stylization — customize shadow styles using textures.
Feature Support
Supports complex objects (multiple parts, multiple submeshes).
Supports Volume — configure via Volume to suit different scene requirements.
Performance Advantages
Extremely low overhead, with most calculations handled in the vertex shader.
Supports SRP Batcher — SRP-compatible batching.
Deployment Instructions
Inspect the PlanarShadows prefab.
Under normal circumstances, it references a PlanarShadowMaterial.
If this property is empty, drag and drop PlanarShadows/Materials/PlanarShadowDefault.mat onto it.

Add the PlanarShadows prefab to your scene.
Create a Volume and attach PlanarShadows.

Configure PlanarShadowsVolume parameters.

Basic Settings

Adjust the Base parameters of the PlanarShadowsVolume.
ShadowColor — Sets the shadow’s color and transparency.
Shadow Offset — Adjusts the shadow’s height offset.
Used to address Z-fighting issues.
Also resolves cases where shadows are incorrectly occluded by the ground.
Gradient Effect Configuration

Distance defines the distance from the shadow pixel to the shadow’s origin, in meters.
The farther from the origin, the lighter the shadow becomes, fading to fully invisible at the specified Distance.
Stylization Effect Configuration

Texture
Defines the stylization pattern; you can apply a texture with a regular decorative pattern.
Ensure the texture’s Wrap Mode is set to Repeat to allow the pattern to tile seamlessly.

Scale — Adjusts the pattern size; smaller values make the pattern denser.
Flow Speed — Controls the movement speed of the pattern.
Static Height Shadows

Static Height Shadows render object shadows at a fixed height, supporting batching for multiple objects.
Caster — Set a LayerMask to specify which layers’ objects should cast Static Height Shadows.
Height — Sets the shadow height; shadows of relevant objects will be rendered at this uniform height.
Static Height Shadows Configuration

Origin Height Shadows render shadows at the model’s origin height, supporting batching for multiple objects.
Caster — Set a LayerMask to specify which layers’ objects should cast Origin Height Shadows.
Root Height Shadows Configuration
Root Height Shadows render shadows at the root node of the composite object.
Add the RootHeightShadow component to the root of composite objects.
Raycast Ground Shadows Configuration

Raycast Ground Shadows use physics raycasting to detect the ground platform’s position and render the object’s shadow there.
Receiver — Set a LayerMask to specify which ground platforms should receive Raycast Ground Shadows.
Add the RaycastGroundShadow component to objects that move or jump between platforms.
Planar Shadows Volume Parameter ReferenceBase
Base
Shadow Color — Shadow color, supports both color and transparency adjustment.
Shadow Offset — Height offset for shadows, fine-tune to prevent Z-fighting between shadows and ground.
Distance Fade
Distance — The distance from the object’s origin at which the shadow fades to nearly invisible.
Stylized
Texture — Stylized texture, the image content defines the stylized pattern.
Scale — Display size of the stylized texture; smaller values result in denser patterns.
Flow Speed — Scrolling speed of the stylized effect.
StaticHeightShadow
Caster — Assign objects that use StaticHeightShadow.
Height — The shadow rendering height for StaticHeightShadow.
OriginHeightShadow
Caster — Assign objects that use OriginHeightShadow.
RaycastGroundShadow
Receiver — Define which ground layers RaycastGroundShadow will render on.
Performance Recommendations
Prefer StaticHeightShadow and OriginHeightShadow for batching support.
RootHeightShadow does not support batching — only use for complex objects at different heights.
RaycastGroundShadow does not support batching — only use for characters jumping between platforms.
Merge meshes where possible to reduce draw calls for RootHeightShadow and RaycastGroundShadow.
OriginHeightShadow Model Requirements
OriginHeightShadow renders shadows at the model’s origin.
For static models, the bottom of the visible model should align with the origin (this is usually the case in modeling).
For animated models:
The origin is usually not at the visual bottom, so avoid using OriginHeightShadow
Use RootHeightShadow or RaycastGroundShadow instead
Limitations
Shadows are rendered horizontally, so this method is not suitable for sloped surfaces.
If the object is outside the camera view, its shadow will also not be visible, even if the shadow itself is within view.
In the Editor, if the mouse hovers over the Material Inspector, Raycast shadows may flicker.
Transparent materials and cutout materials are not supported for shadow rendering:
The transparent areas are usually customized and cannot produce accurate shadow shapes.
Due to inconsistent cutout implementations across materials, accurate cutout shadows cannot be guaranteed.
Enjoying this package?
Give it a quick rating or leave a short review on the Unity Asset Store.
Your feedback helps us improve and add even more features!
Last updated