Skip to main content

๐Ÿ’ก Lesson 11.3: 2D Lights & Shadows

A flat 2D scene lit evenly is fine โ€” but light is what gives a scene mood. The warm glow of a lantern in a dark cave, cold moonlight through a window, a torch that throws long shadows. Unity's URP 2D Renderer brings real-time lighting to sprites: multiple light types, colour blending, normal maps for fake depth, and cast shadows. This lesson turns your lights on.

๐ŸŽฏ Learning Objectives

By the end of this lesson, you will be able to:

  • Confirm your project uses the URP 2D Renderer and add a Global Light 2D
  • Choose between the five Light 2D types: Freeform, Spot, Point (Sprite), Global, and Sprite
  • Use Blend Styles to control how lights combine on a sprite
  • Add a normal map to a sprite so light appears to wrap around surface detail
  • Cast dynamic shadows with a Shadow Caster 2D component

Estimated Time: 45 minutes  ยท  Prerequisite: Lesson 11.2 (Skeletal 2D Animation); a URP project

In This Lesson

The URP 2D Renderer

2D lighting only works when your project renders through the Universal Render Pipeline with the 2D Renderer asset assigned. If you started from Unity's 2D (URP) template, you're already set. Otherwise: create a 2D Renderer (Assets โ–ธ Create โ–ธ Rendering โ–ธ URP 2D Renderer) and assign it in your URP Asset's Renderer List.

The moment the 2D Renderer is active, an important thing happens: your sprites go dark unless a light hits them. That's expected. Sprites now respond to Light 2D objects instead of always drawing at full brightness. Your first job is always to add a Global Light 2D so the scene has a base level of illumination.

โš ๏ธ "My whole scene went black!"

This is the number-one 2D lighting surprise. Switching to the 2D Renderer means unlit sprites render black. Add GameObject โ–ธ Light โ–ธ Global Light 2D and set its intensity to about 1 โ€” this is your ambient base. Then add accent lights on top.

The Five Light 2D Types

Add a light via GameObject โ–ธ Light and pick a type. Each shapes light differently:

  • Global โ€” flat, even light across the whole scene (or a sorting layer). Your ambient base.
  • Freeform โ€” a polygon you shape by hand; light fills the area you draw. Great for irregular glows (a window's light pool, lava).
  • Spot โ€” a cone/circle with inner and outer radius and an angle. The workhorse for lanterns, flashlights, torches. (In the Inspector this is the Point light shape with an adjustable angle.)
  • Point โ€” radial light from a single point, fading with distance. A campfire, a glowing gem.
  • Sprite โ€” uses a sprite's shape and texture as the light itself, for stylised or textured light (stained glass, a neon sign).

Here's how each type falls on the same character sprite:

Diagram of the five 2D light types illuminating a sprite Five panels on a dark background. Panel 1 Global: even light fills the whole panel over a character. Panel 2 Freeform: an irregular polygon glow. Panel 3 Spot: a cone of light narrowing from the top onto the character. Panel 4 Point: a radial circular glow centered on the character fading outward. Panel 5 Sprite: a star-shaped textured light. Each panel labels its light type. Global Freeform Spot Point Sprite
Figure 1: The five Light 2D types on the same sprite. Global lights everything evenly; Freeform fills a hand-drawn polygon; Spot throws a cone; Point radiates and fades; Sprite uses a texture as the light's shape.

Reading the Light 2D Inspector

Select any Light 2D and the Inspector exposes its controls. Here is a Spot (Point-shape) light's Inspector, drawn faithfully:

The Light 2D component Inspector A recreation of a Light 2D component's Inspector. It shows a Light Type dropdown set to Point, a colour swatch set to warm orange, an Intensity slider at about 1.4, Radius fields for inner and outer, a Falloff slider, a Blend Style dropdown, a Target Sorting Layers list, and a Shadows section with a Shadow Intensity slider. Light 2D Light Type Point Color Intensity 1.4 Radius Inner Radius 0.5 Outer Radius 4.0 Falloff Strength 0.7 Blend Style Multiply with sprite (default) Target Sorting Layers Everything Shadows Shadow Intensity 0.75 Overlap Operation: Additive
Figure 2: A Point-type Light 2D Inspector (faithfully recreated). Intensity and Color set the look; Inner/Outer Radius and Falloff shape the reach; Blend Style decides how it combines with the sprite; the Shadows section enables cast shadows.

Blend Styles

A Blend Style defines the math Unity uses to combine a light's colour with the sprite underneath. They're configured project-wide in the 2D Renderer asset (up to four styles) and chosen per-light in the Inspector's Blend Style dropdown.

  • Multiply (default) โ€” light tints the sprite; where there's no light the sprite darkens. This is the natural "realistic" lighting look.
  • Additive โ€” light adds on top, brightening and glowing. Great for magical or neon accents that should never darken the art.

Most scenes use Multiply for the main lighting and reserve an Additive style for special glow lights (spell effects, glowing eyes). Naming your Blend Styles clearly in the Renderer asset saves confusion later.

๐Ÿ“– Definition

Blend Style: one of up to four named light-mixing modes stored on the 2D Renderer asset. Each light references a Blend Style by index; changing the style changes how every light using it composites onto sprites.

Normal Maps for 2D

A flat sprite lit by a moving light still looks flat โ€” the light doesn't wrap around any bumps because there are none. A normal map fixes this. It's a companion texture that encodes, per pixel, which way the surface "faces," so Unity can shade the sprite as if it had 3D relief. A brick wall sprite with a normal map will catch highlights on each brick's edge as your torch moves past.

  1. Author or generate a normal map for your sprite (many 2D tools, or Unity's Sprite Editor โ–ธ Secondary Textures, can produce one).
  2. Assign it as the sprite's Secondary Texture with the reserved name _NormalMap in the Sprite Editor.
  3. Use a material with the Sprite-Lit-Default shader (the 2D template's default) so the renderer reads the normal map.

โœ… Pro Tip

Normal maps shine on large, static, textured surfaces โ€” walls, floors, rocks โ€” where a moving light sells the depth. Don't bother normal-mapping tiny props or fast-moving characters; the effort rarely reads on screen.

Shadow Caster 2D

Lights alone brighten; to make objects block light and throw shadows you add a Shadow Caster 2D component to the objects that should cast. Then enable Shadows on the light (Figure 2's Shadows section) and set its Shadow Intensity.

  • Add Shadow Caster 2D to a wall, crate, or pillar. It uses the object's shape (often auto-generated from its collider) as the shadow silhouette.
  • On the light, tick the Shadows foldout and raise Shadow Intensity (0 = no shadow, 1 = fully black).
  • Objects that should be lit but never cast (like the floor) simply don't get the component.

The result: a Spot light behind a pillar throws a long shadow across the floor that moves as the light moves โ€” real, dynamic 2D shadows.

โš ๏ธ Shadows need a caster AND an enabled light

Two common misses: forgetting the Shadow Caster 2D on the object (the light passes straight through), or leaving Shadows disabled / Shadow Intensity at 0 on the light. You need both sides switched on for a shadow to appear.

Hands-on Challenge

๐Ÿ‹๏ธ Exercise 1: Light a night scene

Objective: Turn a flat scene into a moody, lantern-lit one.

  1. Confirm the 2D Renderer is assigned. Add a Global Light 2D and drop its intensity low (~0.2) for a dark night base.
  2. Add a Spot / Point light on your character to act as a lantern โ€” warm orange colour, intensity ~1.4, outer radius ~4.
  3. Add a Shadow Caster 2D to a crate or pillar, enable Shadows on the lantern light, and set Shadow Intensity ~0.75.
  4. Move the lantern in Play mode and watch the shadow sweep.
๐Ÿ’ก Hint: everything is pitch black

Your Global Light intensity is probably 0, or there's no Global Light at all. Add one and nudge intensity up until the scene reads as "night" rather than "off."

โœ… Success check

The scene sits in dim blue-ish darkness, the lantern casts a warm pool of light on the character, and the crate throws a shadow that moves when the lantern does.

๐Ÿ‹๏ธ Exercise 2: Additive glow accent

Add a second Blend Style named Additive in the 2D Renderer asset. Add a small Point light on a glowing gem or the character's eyes, set it to the Additive style, and confirm it glows brightly on top of the art without darkening anything around it.

๐ŸŽฏ Quick Quiz

Question 1: You switch to the 2D Renderer and all your sprites go black. What's the fix?

Question 2: Which Blend Style brightens and glows on top of a sprite without darkening it?

Question 3: What must an object have for a light to cast its shadow?

Summary

๐ŸŽ‰ Key Takeaways

  • 2D lighting needs the URP 2D Renderer; under it, unlit sprites go black โ€” always add a Global Light 2D base.
  • Five Light 2D types: Global (ambient), Freeform (hand-drawn shape), Spot (cone), Point (radial), Sprite (textured).
  • Blend Styles control light-to-sprite math: Multiply for realistic lighting, Additive for glows.
  • Normal maps (assigned as the sprite's _NormalMap secondary texture) let light wrap around fake surface detail.
  • Shadow Caster 2D on an object + Shadows enabled on the light = dynamic cast shadows.

๐Ÿš€ What's Next?

You can animate a 2D character and light a 2D scene. Time to combine everything โ€” parallax backgrounds, a lit tilemap, your animated hero, particles, and post-processing โ€” into one atmospheric level. In Lesson 11.4: Polishing a 2D Scene you'll take the Module 10 platformer and make it beautiful.

๐Ÿ’ก Mood, on demand

Lights, blend styles, normal maps, shadows โ€” the same flat sprites can now feel like dawn, midnight, or a torchlit cave. Lighting is the fastest way to make a 2D game feel alive.