Before starting to create final Assets and approach lighting for a Scene, you need to figure out your lighting strategy. Altering your lighting strategy late in development has a high impact on your workflow. Taking the time to get this right before you enter production saves time overall, and allows you to achieve better performance and higher visual fidelity.
As with all development, there’s almost always a trade-off between the benefits and impacts of one setup over another. There are times, however, where certain technologies give you options to mitigate these trade-offs within specific constraints. Knowing each feature’s trade-offs allows you to choose what’s best for your project.
A typical daytime Scene with outdoor areas has the following lighting components:
Hemisphere lighting (sky contribution)
Direct lights (Sun + local lights)
Indirect lights (bounced and reflected lighting)
This seems like three simple components. But because you can mix and match Realtime lights, Mixed lights, Baked lights, static GameObjects and dynamic GameObjects, you can end up with a diverse range of lighting options.
Unity caters to lots of different lighting strategies and project scenarios. To understand lighting modes and setup, see documentation on Lighting Modes.
For newcomers, it can be overwhelming to figure out which setup works best for their Scene, and what the trade-offs are. So let’s consider the most commonly used lighting setups:
Basic real-time lighting: The specular highlights from the light are visible, but there is no indirect lighting.
Baked lighting: Soft baked shadows are visible, and static indirect lighting is visible in high resolution, but there are no specular highlights from lights, and dynamically lit GameObjects don’t cast shadows.
Mixed lighting: Similar to Baked lighting, but there is specular response from lights, and dynamically lit GameObjects do cast shadows.
Real-time lighting and GI: Proper indirect lighting response and specular response are visible, lights are all moveable and updateable, but there’s no angular soft shadow.
All options enabled): Depending on the settings of each light, you can achieve the combination of all the above options.
The following images show the notable differences between these setups:
Note: Realtime GI can’t bake static ambient occlusion, so it’s not included.
Basic real-time lighting and ambient (with no Realtime GI or Baked GI)
Basic real-time lighting is generally used in stylistic visual projects and prototype phases.
Typical platform target: Console and PC
Advantages:
All direct lights and shadows are applied in real time, and are therefore movable.
Allows for fast iteration, because there is no precomputation, baking, or mesh preparation.
Dynamic and Static GameObjects are lit using the same method, so Light Probes are not required.
Disadvantages:
No hemisphere occlusion, just skybox/ambient value, and the color in the area is not lit by direct lighting.
Without GI or indirect lighting component, the Scene might not give the best visual outcome.
All baked lighting and Light Probes
Baked lighting is generally useful for games where run-time performance is an issue but there’s room in memory, such as top-down isometric mobile games and high frame-rate VR games.
Typical platform target: Mobile platform, VR, console and low end PC
Advantages:
All lights are baked for static GameObjects. They produce ambient occlusion and indirect lighting.
Unity can bake area light bake support and soft shadow angles onto statically lit GameObjects.
Fastest run-time performance among the common setups listed here.
Disadvantages:
Can slow down lighting iteration because lights are baked, which means Unity needs to re-compute lights whenever the Scene changes (unless you’re using Progressive Lightmapper)
Dynamically lit GameObjects are only lit using Light Probes.
Specular highlights only rely on cubemaps and reflections, not on light sources.
There is no shadowing from dynamic GameObjects.
Can require a lot of run-time memory, depending on how many light map textures are used in the Scene.
Might require authoring texture coordinates channel 2 (UV2 for light map) if GameObjects texture charts overlap.
Mixed lighting with Shadowmask and Light Probes
Mixed lighting is often useful in games where time-of-day lighting (such as sun movement) is not important.
Typical platform target: VR, console and PC
Advantages:
Similar to all Baked lighting, but in Mixed lighting, Dynamic GameObjects get real-time specular lighting and cast real-time shadows, while static GameObjects get baked shadowmasking, resulting in better visual quality.
Disadvantages:
GameObjects have a limit of 4 Shadowmasks. Additional shadow casting lights gets baked.
Rendering real-time lights at run time is more resource-intensive.
Mixed lights can drastically affect performance in certain setups.
For more information on Shadowmask lighting, see Shadowmask.
Real-time lighting with Realtime GI and Light Probes
This setup is useful in open area games where you need time-of-day lighting updates (such as the sun moving) and dynamic lighting effects.
Typical platform target: Console and PC
Advantages:
This allows for fast lighting iteration with real-time indirect lighting.
Dynamic and static GameObjects get real-time specular lighting and shadows.
Can use less memory than Baked lighting for indirect lighting.
Has a fixed CPU performance impact for updating global illumination.
Disadvantages:
Occlusion isn’t as detailed as Baked lighting, and usually must be augmented by Screen Space Ambient Occlusion (SSAO) and per-object texture baked AO.
No area/light angle soft shadows for static GameObjects.
Real-time lights can drastically affect performance in certain setups.
Precompute times can take a significant amount of time if there are too many GameObjects contributing to the static lighting, especially without an optimized UV setup. For more information, see Global Illumination UVs.
You would only want to generally enable all lighting options in games with high fidelity requirements that have tightly controlled memory usage and performance limits. You should only do this if you fully understand each individual system, and know how to handle each lighting combination.
Typical platform target: Console and PC
Advantages:
This is the complete set of lighting features, giving you full functionality.
Disadvantages:
Has high performance requirements at run time, with high memory usage.
Increases the workflow time, by requiring more UV authoring and baking time.
To help you learn about lighting, the Spotlight Tunnel Sample Scene uses real-time lighting with Realtime GI. This provides a diverse range of specular responses, good bounce lighting, and allows you to quickly iterate on lighting.
Is something described here not working as you expect it to? It might be a Known Issue. Please check with the Issue Tracker at issuetracker.unity3d.com.
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thanks for helping to make the Unity documentation better!