Point Shadow Baker: URP Performance Optimizer
Convert dynamic point lights to high-performance static light depth data in one click.
by Mono Assets
Price History +
Every shadow-casting Point Light in your scene forces Unity to re-render all affected objects six times per frame—even when those objects are completely static!
Stop wasting GPU performance. With Point Shadow Baker: URP Performance Optimizer, you can bake your static Point Light shadows into an optimized depth map with a single click. Unlike traditional lightmaps, your materials retain full PBR fidelity (including metallic and smoothness response), and the entire baking process takes only seconds. Achieve massive performance gains without sacrificing the look of your game.
Proven Performance: In a stress test with 42 shadow-casting Point Lights, this asset boosted performance from 80 FPS to 400 FPS—a massive 5x increase.
Key Features
- High Fidelity: Full PBR support (Metallic/Smoothness) maintained.
- Versatile Geometry: Works with Mesh Renderers, Skinned Mesh Renderers, and LOD Groups (automatically targets highest LOD).
- Shadow Control: Supports both Soft and Hard shadows with variable map sizes (128px to 2048px).
- Smart Integration: Seamlessly works alongside other light types (Directional, Spot, etc.) and respects layer masks and visibility toggles.
- Workflow: Fully visible in Editor; includes robust filtering to ignore disabled/inactive renderers automatically.
- Proceduralism: Shadows can now be baked either with Click to Bake or Bake On Awake, or alternatively by calling ShadowLightBaker.BakeShadows() allowing for procedural workflows.
- Dynamic Objects: The asset has support for moving objects (including skinned meshes and cutout materials). These are rendered on top of the static shadow map and drawn in a single draw call instead of six!
- Analytical Primitive Dynamic Objects: The asset supports Boxes and Spheres as Analytical Primitive Objects that can move and rotate (and scale in the case of boxes). These can cast perfectly accurate shadows regardless of shadowmap resolution!
- Point Light Effects: By adding a Light Effect Attachment to your point lights you can add a Bulb, Halo, Aura and Fog in any combination!
Known Limitations & Compatibility
- Rendering Pipeline: Supports URP (Deferred Rendering only). Note: Ensure "Accurate G-Buffer Normals" is unchecked in your URP asset settings.
- Static Preference: The asset is designed for static lights that do not move. Baked objects should not move, and dynamic objects not marked as Dynamic Shadow Objects will not cast shadows. While technically both the light and props can move, this forfeits most of the performance advantages that this asset brings.
- Dynamic Limitation: Dynamic Lights need to have one side occluded to work. This can be a limiting factor for certain light fixtures. For instance a thin candelabra that illuminates moving characters with no obvious flat plane to project the missing depth plane on is a bad use case for this asset.
- Unsupported: Built-in/HDRP, Forward/Forward+ rendering, Terrain (trees/grass), Cookies, and transparent/colored shadows.
- Light Types: Optimized exclusively for Point Lights.
How to Use
Integrating Point Shadow Baker: URP Performance Optimizer into your workflow is a streamlined, three-step process:
- Configure: Add any number of Point Lights to your scene and adjust their intensity and radius.
- Assign: Select your lights and attach the Shadow Light Baker component.
- Bake: Choose your desired shadow quality (Hard or Fake Soft) and click Bake.
The tool will iterate through each selected light, generating an optimized depth cubemap and replacing the dynamic Point Light with an ultra-efficient mesh renderer. Also remember to use the copy button when copying lights!
Making it work with Dynamic Objects (moving)
You can upgrade any light with a Dynamic Shadow Attachment to allow it to cast shadows from dynamic objects. This does come with the caveat that those lights will now be baked using 5-sided cube maps, meaning one side of the light has a depth plane replacing its content on that side (See images for a intuitive understanding).
- Prepare Scene: Add a Dynamic Shadow collection to your scene to track all Dynamic Shadow Casting objects.
- Mark Dynamics: Select your characters, moving platforms etc and attach the Dynamic Shadow Object to them.
- Allow Shadows: Select the lights that already have a Shadow Light Baker component on them that you want to support dynamic shadows and add a Dynamic Shadow Attachment to them.
- Adjust: Adjust the elongation and depth until the depth plane lies just under the surface of the Brazier, Torch, Wall or any other straight surface holding the light source.
- Bake Again: Bake these lights again since they can no longer use their old 6-sided depth map with dynamic objects.
Remember to keep the elongation as low as possible as this spaces the cubemap as evenly as possible. If high elongation is needed you might have to compensate by slightly upping the shadow map resolution. See the Dynamic Object Test Scene for a live demo.
Shadow Light Baker: Main Component Overview
- Timing: Either Click to Bake (default) or Bake on Awake. Both work like the names suggest.
- Save Path: The destination folder (relative to your Assets directory) where your generated depth cubemaps are stored.
- Light Bake Name: A unique identifier for the light; used as the filename for the generated depth map.
- Current Texture: A thumbnail preview of the baked cubemap. Click to inspect the result.
- Baking Size: Sets the resolution per cubemap face (Default: 512). Note: Total pixel count is calculated as Size^2 times 6. 256 is often sufficient for high-quality fake soft shadows.
- Lighting Mode: Cinematic: Utilizes a more sophisticated Smith/Disney BRDF, ideal for high-smoothness or metallic surfaces.
- Lighting Mode: URP Match: Strictly adheres to the standard URP BRDF for a 1:1 match.
- Shadow Baking Mode: Fake Soft Shadows: Baked into dual-channel (RG) maps, storing depth and soft-shadow approximation. Note1: Only works correctly if you can guarantee that no dynamic objects ever get between the shadowcasters and the light. Note2: Requires double the VRAM of Hard mode, but significantly optimizes runtime performance by replacing PCF texture fetches with a single fetch.
- Shadow Baking Mode: Hard Shadows: Baked into single-channel, half-float depth maps.
Shadow Light Baker: Advanced Shadow Settings
- Depth Sampling Mode: PCF (2-16): Samples 2-16 points for smoother edges. Works with Bake Mode Hard or Bake Mode Fake Soft for even softer shadows!
- Depth Sampling Mode: One Sample: High performance, clean edges, zero noise. Best for sharp, stylized shadows.
- PCF Sample Radius: Controls the spread of PCF samples. Default values are optimized for standard scales.
- Light Source Radius (Soft Mode): Defines the area for random sample distribution. A default of 0.05 is recommended for most scenes.
- Baking Soft Samples (Soft Mode): Determines the number of passes for the soft-shadow effect. We recommend 200 samples for the best balance of smoothness and minimal artifacts.
Shadow Light Baker: Optimization Filters
- Exclude Game Objects: Drag and drop objects or parent hierarchies here to ignore them during the bake.
- Only Include: Limit the bake to a specific subset of objects. This is highly recommended for optimizing bake times in massive, complex scenes.
Dynamic Shadow Attachment: All Settings
- Missing Face: The direction that will be replaced by a shadow plane.
- Depth on Missing Face Side: Defines the depth (distance) until a flat surface is reached on its missing face side.
- Missing Face Elongation: Narrows the cubic cone area on the missing face side. You can either move the light source close to a flat surface on this side or increase elongation. Increasing elongation makes the cubemap spacing more uneven so try to keep this setting as low as possible to not have to increase shadow map size.
Dynamic Shadow Object: All Tweakable Settings
Most variables on this component are made for viewing purposes only. The two that are meant to be changed are:
- Object Never Tilts: If the oject does not rotate around any axis but world up you can check this checkbox to make its bounding sphere smaller. Smaller spheres is better because the bounding sphere determines when and if the object needs to be drawn to the dynamic shadow map.
- Radius Multiplier: If your character becomes bigger than its initial pose you can account for this by increasing the radius multiplier.
Dynamic Primitive Attachment: All Tweakable Settings
If your shadowcasting shapes can be approximated using Primitive Boxes and Spheres you can get perfect shadows regardless of shadow resolution with this attachment:
- Calculation Type: SDF Raymarching: Super accurate very soft shadows. Slower than Ray Intersection if not using PCF.
- Calculation Type: Ray Intersection: Super fast hard shadows that can be made softer with PCF (but at increased cost).
- Softness SDF: When using SDF raymarching this defines the softness, lower values makes the shadows softer.
- Primitive Bias: Primitive shapes are way more Analytically accurate than actual meshes. This pushes the rays slightly off the analytical surfaces to avoid Shadow Acne.
- Primitives: A list of transforms with their corresponding shapes. Box sizes are assumed to start at 1,1,1 and origin at 0,0,0 with local scale defining their actual size. Spheres are the same except they only scale uniformly by the localScale.x component.
Note that a few primitives are fast but using too many can create a performance bottleneck. The attachment is therefore limited to 20 visible primitives at a time.
Future Development
If you have a feature request or an idea to improve the workflow, please feel free to reach out—I’m always interested in hearing how I can make the tool even better for your projects.
Support
Encountered an issue or have a technical question? I’m here to help. You can reach me at monoassetshop@gmail.com. I strive to provide fast, helpful responses, though please keep in mind that I may be in a different time zone. I appreciate your patience and your support!