Before starting to create final Assets and approach lighting for a SceneA Scene contains the environments and menus of your game. Think of each unique Scene file as a unique level. In each Scene, you place your environments, obstacles, and decorations, essentially designing and building your game in pieces. More info See in Glossary, 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 GameObjectsThe fundamental object in Unity scenes, which can represent characters, props, scenery, cameras, waypoints, and more. A GameObject’s functionality is defined by the Components attached to it. More info See in Glossary 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:
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 lightingA Light Mode for creating indirect lighting, shadowmasks and subtractive lighting. Indirect lighting gets baked into lightmaps and light probes. Shadowmasks and light probes occlusion get generated for baked shadows. More info See in Glossary: 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 occlusionA method to approximate how much ambient lighting (lighting not coming from a specific direction) can hit a point on a surface. See in Glossary, 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
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 meshThe main graphics primitive of Unity. Meshes make up a large part of your 3D worlds. Unity supports triangulated or Quadrangulated polygon meshes. Nurbs, Nurms, Subdiv surfaces must be converted to polygons. More info See in Glossary preparation.
Dynamic and Static GameObjects are lit using the same method, so Light ProbesLight probes store information about how light passes through space in your scene. A collection of light probes arranged within a given space can improve lighting on moving objects and static LOD scenery within that space. More info See in Glossary are not required.
No hemisphere occlusion, just skyboxA special type of Material used to represent skies. Usually six-sided. More info See in Glossary/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
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.
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 cubemapsA collection of six square textures that can represent the reflections in an environment or the skybox drawn behind your geometry. The six squares form the faces of an imaginary cube that surrounds an object; each face represents the view along the directions of the world axes (up, down, left, right, forward and back). More info See in Glossary 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
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.
GameObjects have a limit of 4 Shadowmasks. Additional shadow casting lights gets baked.
RenderingThe process of drawing graphics to the screen (or to a render texture). By default, the main camera in Unity renders its view to the screen. More info See in Glossaryreal-time lightsA Lighting Mode for Lights that need to change their properties or which are spawned via scripts during gameplay. Unity calculates and updates the lighting of these Lights every frame at run time. They can change in response to actions taken by the player, or events which take place in the Scene. More info See in Glossary at run time is more resource-intensive.
Mixed lights can drastically affect performance in certain setups.
For more information on Shadowmask lighting, see ShadowmaskA Texture that shares the same UV layout and resolution with its corresponding lightmap. More info See in Glossary.
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
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.
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
This is the complete set of lighting features, giving you full functionality.
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.
2018–03–21 Page published
Making believable visuals Best Practice Guide added in Unity 2017.3