Lighting Strategy

Checked with version: 2017.3

-

Difficulty: Intermediate

Before starting to create final assets and approaching lighting for a Scene, it is important to figure out your lighting strategy. At the start of a project, it is very easy for content creators - eager to start making cool things - to overlook this important step. Altering your lighting strategy late in development is a costly operation. Taking the time to get this right before you enter production will save time while giving better performance and a higher visual fidelity.

Much like anything in real life, there’s almost always trade-off between the benefits and costs of one setup or another. Just as a Formula 1 Car isn’t well suited for everyday groceries shopping compared to its gas saving hybrid car siblings. There are times however, where certain technologies will give you options to mitigate these trade-offs within specific constraints and knowing each features and trade-off will allow you to choose what’s best for your project.

Going back to our Lighting, a typical Scene, at daytime, with outdoor areas can be broken down to 3 lighting components:

  1. Hemisphere (Sky contribution).

  2. Direct lights (Sun + Local lights).

  3. Indirect lights (Bounced lighting).

This seems like three simple components. How you choose to mix and match real time lights, mixed lights, baked lights, static objects and dynamic objects ends up creating a diverse range of potential lighting options.

In Unity we cater to lots of different lighting strategies and project scenarios.

Find the documentation to understand lighting modes and setup here.

For newcomers, this can be overwhelming to figure out which setup and what the trade-off are for each setup. Let’s distill this mass of information down to the most commonly used setup.

These 5 are the most commonly used lighting setup.

description

Visual notable differences between these options:

  1. Basic realtime, the specular highlights from the light are visible but no indirect lighting.

  2. Baked, soft baked shadows are visible, high resolution static indirect lighting, but there is no specular response from lights and dynamically lit object don’t cast shadows.

  3. Mixed Lighting, similar to Baked, but with specular response and dynamically lit object cast shadows.

  4. Realtime Light and GI, proper indirect lighting response, specular response are visible, lights are all moveable and updateable, but there’s no angular soft shadow.

  5. Guns Blazing all options enabled, depending on the settings of each light you can achieve the combination of all the above options.

description

The slideshow above showcase baked Ambient Occlusion when enabled. NOTE: Realtime GI can’t bake static ambient occlusion and hence not included.

Here are the general characteristics for each configuration:

Basic Realtime lighting + Ambient (with no Realtime GI or Baked GI).

Typical platform target: Console and PC. Generally used in stylistic visual project and prototype phase.

Advantage:

  • All direct lights and shadows are real-time, therefore movable.
  • Fast iteration because of no precompute or baking and mesh preparation.
  • Dynamic objects and Static objects are lit using the same method, no Light Probes required.

Disadvantage:

  • No Hemisphere occlusion, just straight skybox/ambient value and color in area not lit by direct lighting.
  • Without "Global Illumination" / indirect lighting component, scene might not give the best visual outcome.

All baked lighting + Light Probe.

description

Typical platform target: Mobile platform, VR, console and low end PC. Generally used in games where runtime performance in an issue but there’s room in memory, such as top down isometric mobile games and high frame rates VR game.

Advantage:

  • All lights are baked for static objects, produce ambient occlusion and indirect lighting.
  • Area light bake support and soft shadow angle can be baked onto statically lit objects.
  • Fastest in runtime performance among the options listed here.

Disadvantage:

  • Can slow down lighting iteration since lights are baked, therefore requiring light rebuild on Scene changes if progressive Lightmapper aren’t used.
  • Dynamically lit objects are lit using Light Probes only.
  • No Specular highlights from light source, relying only on cubemap/reflection.
  • No shadowing from dynamic objects.
  • Can cost a lot of runtime memory depending on how much lightmap textures used in the scene.
  • Might require authoring texture coordinates channel 2 (UV2 for lightmap).

Mixed lighting with Shadowmask + Light Probe.

description

Typical platform target: VR, console and PC. Generally used in majority of console games and pc games where time of day lighting such as sun movement is not important. Advantage:

  • Similar to all baked lighting, but in Mixed lighting, Dynamic object gets real-time specular and cast realtime shadows, while the static object gets baked shadowmask resulting in better visual quality.

Disadvantage:

  • Object can only have 4 shadowmask limit.
  • Cost additional performance in runtime for rendering the real-time lights.
  • Care needs to be taken in using mixed lights as they can drastically affect performance in certain setups.

The above list is an oversimplification description of shadowmask lighting. Complete information can be found here.

Realtime lighting with Realtime GI + Light Probe.

description

Typical platform target: Console and PC. Generally used in open area game where time of day lighting updates is required and dynamic lighting effect are required as part of the game design. Advantage:

  • This allow fast lighting iteration with realtime indirect lighting.
  • Dynamic and static objects get real time specular and shadows.
  • Can use less memory than baked lighting for giving indirect lighting effect.
  • Fixed cost CPU time performance for updating GI.

Disadvantage:

  • 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 objects.
  • Care needs to be taken in using realtime lights as they can drastically affect performance in certain setups.
  • Precompute times (Generate lighting) time can took significant amount of time if there’s too much object contributing to the static lighting especially without optimized UV setup (Requires authoring texture coordinates channel 3 (UV3) for Enlighten Realtime GI further optimization and/or projection fixes.)

In depth information in optimizing Realtime GI can be found here.

Guns blazing, all option enabled.

description

Typical platform target: Console and PC. Generally used for games with high fidelity requirements with tightly controlled memory usage and performance limit. Best enabled when the content creators completely understood each individual system and has proper knowledge on handling each of the lighting combination implication.

Advantage:

  • This is the complete set of lighting features, it gives your content creator all the functionality.

Disadvantage:

  • Can potentially burn performance at run time, memory usage.
  • Increase the workflow burden (UV authoring and baking time).

For faster iteration and learning lighting a Scene, responsive visual feedback is necessary. For this reason, the Spotlight Tunnel Sample Scene is using Realtime Lighting w/ Realtime GI. This will give us a nice range of specular response, good bounce lighting, and let us change our lights on the fly.

Graphics

  1. Introduction to Lighting and Rendering
  2. Choosing a Lighting Technique
  3. The Precompute Process
  4. Choosing a Rendering Path
  5. Choosing a Color Space
  6. High Dynamic Range (HDR)
  7. Reflections
  8. Ambient Lighting
  9. Light Types
  10. Emissive Materials
  11. Light Probes
  1. Introduction to Precomputed Realtime GI
  2. Realtime Resolution
  3. Understanding Charts
  4. Starting the precompute process
  5. Probe lighting
  6. Unwrapping and Chart reduction
  7. Optimizing Unity's auto unwrapping
  8. Understanding Clusters
  9. Fine tuning with Lightmap Parameters
  10. Summary - Precomputed Realtime GI
  1. Lighting Overview
  2. Lights
  3. Materials
  4. The Standard Shader
  5. Textures
  6. Using Skyboxes
  7. A Gentle Introduction to Shaders
  8. Using detail textures for extra realism close-up
  9. Frame Debugger
  1. Cameras
  2. Image Effects: Overview
  1. Meshes
  2. Mesh Renderers and Mesh Filters
  1. Where to Start?
  2. Preparing Unity Render Settings
  3. Lighting Strategy
  4. Modeling
  5. Standard Shader/Material PBS and texturing
  6. Lighting and Setup
  7. Understanding Post Process Features
  8. Dynamically Lit Objects
  9. Sample Project File
  1. Using Cameras
  2. Using Lights
  3. Fun with Lasers!
  4. The Particle System
  5. Cinematic Explosions - PIT
  6. Cinematic Composition - PIT
  7. Image Effects: Overview
  8. Fun with Explosions!
  9. Exploring the Blacksmith Environment
  1. Turning it up to 11: Making Unity 5 look Awesome!
  1. Substance - Introduction
  2. Substance - Understanding PBR
  3. Substance - Working with PBR in Unity
  4. Substance - Using Substance materials in Unity
  5. Substance - Optimization for Substance materials
  6. Substance - Creating rock shapes
  7. Substance - Creating rock material, Pt 1
  8. Substance - Creating rock material, Pt 2
  9. Substance - Creating the dirt ground material
  10. Substance - Creating the rock ground material, Pt 1
  11. Substance - Creating the rock ground material, Pt 2
  12. Substance - Publishing the Substance
  13. Substance - Creating a blocking scene
  14. Substance - Creating the ground model
  15. Substance - Modelling the rock assets
  16. Substance - Texturing the upper body
  17. Substance - Exporting textures from Substance Painter
  18. Substance - Creating a scene in Unity, Pt 1
  19. Substance - Creating a scene in Unity, Pt 2
  1. Introduction and Goals
  2. Flame Particles Overview
  3. Particle Emission and Color
  4. Adding Movement To Particles With Noise
  5. Creating The Ember Particles
  6. Adding Lighting To Particles
  7. Creating Sparks With Particle Trails
  8. Particle Question and Answers
  1. Introduction and Goals
  2. Adding a Second Camera
  3. Adding Minimap Icons
  4. Render Textures and UI
  5. Adding A UI Mask and Border Image
  6. Questions and Answers
  1. Session Introduction
  2. Rendering In Unity
  3. Anatomy Of An Unlit Shader
  4. The Vertex Function
  5. The Fragment Function and Color Tint
  6. Making A Transparent Shader
  7. Displacing Vertices and Clipping Pixels
  8. Questions and Answers
  1. Introduction and Session Goals
  2. The VideoPlayer Component
  3. Texturing Objects With Video
  4. Playing and Pausing
  5. Playing A New Clip
  6. Displaying Current Time and Clip
  7. Animated Playhead
  8. Questions and Answers
  1. Overview and Goals
  2. Tonemapping and Color Grading
  3. Camera Movement & Animation
  4. Post Processing Volumes
  5. Timeline & Cinemachine
  6. Questions and Answers