Lighting in Unity — Part 2: Shadows & Baking Basics
A beginner’s guide to understanding shadows, lighting modes, and how to bake lighting in Unity.
Shadows are what give your game world depth and realism. Without them, even the best-lit scene feels flat. In this second part of the Lighting Deep Dive, we’ll break down how shadows work in Unity, the differences between lighting modes (Realtime, Mixed, and Baked), and how to bake lighting for better performance.
You’ll also get hands-on by setting up a basic scene that shows how shadows behave under different light types.
Let’s get into it!
Lighting Modes in Unity: Realtime, Mixed, and Baked
Unity gives you three lighting modes that control how lights affect your scene and how shadows are calculated.
Realtime Lighting
- Light is calculated every frame at runtime
- Shadows and intensity update in real-time
- Most flexible, but worst for performance
Use for: dynamic lights (e.g., flashlights, day/night cycles)
Baked Lighting
- Lighting and shadows are pre-calculated
- No performance cost during gameplay
- Doesn’t affect moving objects
- Requires baking in the Lighting window
Use for: static environments, indoor scenes
⚠️ Area Lights don’t work in URP, even if you set them to Baked. Unity lets you select it, but URP doesn’t support rendering Area Lights at all, baked or realtime.
Mixed Lighting
- A hybrid of realtime and baked
- Static objects use baked lighting
- Dynamic objects still receive realtime light/shadows
- Best balance of quality + performance
Hard Shadows vs Soft Shadows in Unity
When a light casts shadows in Unity, you can control the shadow style using the Shadow Type dropdown in the Light component.
Hard Shadows
- Sharp edges
- Cost less performance
- Good for stylized or retro visuals
Best for: low-end builds, blocky environments, toon styles
Soft Shadows
- Blurry, feathered edges
- More realistic
- Slightly more performance-intensive
Best for: realistic lighting, smooth surfaces, natural light
Where to Set It:
- Select the light → In Shadows section
- Change Shadow Type to Hard Shadows or Soft Shadows
(If set to “No Shadows,” nothing will render!)
Shadow Settings Breakdown (Light Component)
Unity gives you several settings to control how shadows look and behave. These can help with visual clarity and fix issues like flickering or disappearing shadows.
Shadow Strength
Controls how dark the shadow is
- 1 = fully black, 0 = invisible
- Use lower values for softer, more natural shadows
Resolution
Affects how crisp the shadow edges look
- Options: Low, Medium, High, Very High
- Higher res = cleaner shadows, but costs more performance
In URP, shadow resolution is managed globally through the URP Asset, not directly on each light. You can still override it if needed, but the defaults keep things optimized.
Bias
- Offsets the shadow from the surface to prevent flickering
- If too low, you get shadow acne
- If too high, shadows might float away from objects
Normal Bias
- Like Bias, but based on surface normals
- Helps with steep angles or curved surfaces
- Tip: Tweak Bias first, then Normal Bias if needed
How to Access Shadow Settings in URP:
Open Project Settings:
- Go to Edit > Project Settings.
Access the URP Asset:
- In Graphics, click on your Universal Render Pipeline Asset (URP Asset) under Scriptable Render Pipeline Settings.
Find Shadows Section:
Inside your URP Asset, scroll down to the Shadows section, where you’ll find shadow-related settings:
- Shadow Resolution
- Shadow Distance
- Cascade Count
- Bias
- Normal Bias
Lighting Settings Window: Environment Lighting Tab
The Lighting Settings window is where Unity lets you adjust environmental lighting for your scene, including how ambient lighting behaves and interacts with your scene.
To adjust the lighting for your scene, including ambient lighting, follow these steps:
- Go to Window > Rendering > Lighting to open the Lighting Settings window.
- Click on the Environment tab to access settings for ambient light and reflections.
Ambient Lighting in URP
In URP, ambient lighting is primarily controlled through the Skybox. You can adjust the ambient light intensity and reflective properties, but there isn’t a dedicated “Color” option for ambient light as in the Built-In Pipeline.
Key Settings:
Skybox:
- Skybox Material controls how ambient light behaves in the scene. If you’re using a skybox, the ambient lighting will be automatically derived from the skybox material.
- To change the ambient lighting color, you can adjust the Skybox Material to use a color-based skybox, or set up a gradient skybox for more control.
Environment Lighting:
- Source: Set to Skybox for realistic lighting derived from the sky. To simulate colored ambient light, you can use a color-based skybox
- Intensity Multiplier: Controls the strength of the ambient light. Increasing this value brightens your scene.
Other Settings You Can Adjust in the Environment Tab:
Sun Source:
- This sets the light source for the skybox. By default, it’s set to None, but you can assign a Directional Light to this field, which would simulate sunlight in your scene (if you’re using a procedural skybox).
Environment Reflections:
- Source: You can choose between Skybox (default), Custom reflection sources, or None.
- Resolution: Adjusts the quality of reflections based on the reflection probe.
- Intensity Multiplier: Controls how intense the reflections are. This can be handy for making water or reflective surfaces look more realistic.
Fog (if you want to add atmosphere):
- If you’re aiming for a foggy or misty atmosphere, you can enable fog under the Other Settings. It’s a simple way to add distance effects to your scene.
Halo Strength / Flare Strength:
- These affect light halos around light sources (such as street lamps, point lights, etc.). If you want a glow effect, tweaking these settings helps with adding light effects.
Lightmapping & Your First Bake
Unity uses lightmaps to store baked lighting and shadows for static objects. These maps help improve performance because lighting doesn’t need to be calculated at runtime.
Before you can tweak Lightmapping settings, Unity needs a Lighting Settings Asset assigned.
Click “New” at the top of the Lighting window to create one. This unlocks advanced options like sample counts, bounces, and ambient occlusion for baked lighting.Once that’s done, hit Generate Lighting to bake your first lightmap and see the results on static objects.
How to Bake Lighting in URP
- Go to Window > Rendering > Lighting
- Click on the Scene tab
- Under Lightmapping Settings, make sure:
Baked Global Illumination is enabled
Lightmapper is set to Progressive CPU (or GPU if supported)
- Click the Generate Lighting button
Wrapping Up Shadows & Baking Basics
In Part 2 of the Lighting Deep Dive, we covered:
- The difference between Realtime, Mixed, and Baked lighting
- How to use Hard and Soft shadows
- What Shadow Strength, Resolution, and Bias actually do
- Where to find Environment Lighting settings in URP
- How to set up a Lighting Settings Asset and perform your first lightmap bake
- A clean demo setup using Static objects and Baked Global Illumination
Up next: we’ll explore Shadow Cascades, Light Probes, and how to make your scene shine without burning your GPU!