Skip to content

Tutorials · Light and Shadow · Chapter 9

Sprites in the light

25 minutes Uses: Sprite, Light

By the end

  • The lanterns’ glass and the window drawn at their own colours, whatever the light
  • Three runes that show only where light reaches them, and one of them hidden in a pillar’s shadow
  • A halo, a cold pocket and a moon, one on each of the other three channels, and what each channel costs
On this page

Glass that glows

So far a sprite is as dark as the light on it: that is what lighting is. But a lantern’s glass is lit from inside, and the window is lit from outside, and neither should go dark with the hall. A sprite can opt out.

  1. Select lantern_1. Type light in the Inspector’s filter box, which narrows its Sprite to the rows that answer to light, and tick Unshaded.
  2. Do the same on lantern_2, lantern_3 and window_glass.
  3. Press Ctrl+S.
The window and the bay round it, with the third lantern on the right, before Unshaded: the window’s glass a pale grey-blue, and the lantern’s glass a dull yellow-green, both only as bright as the light on them leaves them
Before: the glass as the light leaves it.
The same window and lantern after Unshaded: the window’s glass is bright white and the lantern’s glass a little brighter, while the stone round them is as dark as before
After: the glass at its own colours.
Unshaded
Ticked, the sprite is drawn at its own colours whatever the light does: the ambient does not darken it and no light changes it. For a flame’s glass, a lit window, a sign. Unticked, it is lit as every other sprite is.

Marks that show only in the light

The opposite is a mark that exists only where light falls on it: a rune cut into the floor that glows when a lantern’s light reaches it, and is not there in the dark. The starter has three, hidden until now.

  1. In the Hierarchy, click the crossed eye beside rune_a, rune_b and rune_c, so that all three are Visible.
  2. Select each, filter the Inspector with light as before, and tick its Sprite’s Light Only. Leave Unshaded off.
  3. Press Ctrl+S.
The first rune selected, its Inspector narrowed with the filter light to its Sprite: Unshaded unticked, Light Only ticked, Normal Map none and Specular 0.000; the Viewport shows the small rune on the floor strip at the left, and all three runes listed as visible in the Hierarchy
Light Only
The sprite shows only as much as the lights reach it, with the ambient taken out: where no light falls, it is not drawn at all, and fully lit it is as bright as an Unshaded sprite. For a rune, a beam in dusty air, a pattern cast on a wall. It is drawn in the pass that already composites the light, so it opens no pass of its own.
The floor strip with the three runes: a small rune on the wall at the left, lit by the first lantern, and a rune at the right, under the third lantern, both glowing pale blue; between them, behind the left pillar, there is nothing to see; at the far right, a timber leans by the doorway’s glow
The three runes: one in the first lantern’s light, one under the third lantern, and the middle one, behind the left pillar, not there.
The same floor strip with the left pillar’s Occluder off: a third rune, a small upright arrow, appears just right of the pillar, beside the other two
For comparison, the left pillar’s Occluder off: the lantern reaches the middle rune and it shows.
The same floor strip with the moonlight off: the first and third runes are a little dimmer and greyer than before
For comparison, the moonlight off: the first and third runes are a little dimmer.

Four ways to light

Every light so far has added to the room’s own lighting, and the sum has multiplied each sprite’s colour: that is channel 0. The other three channels do something else, and each is a light of its own here.

  1. Select Hall, press + Add node, and choose Light. Rename it halo. Leave Kind on Point. Set its Position to 81.5 and 172.5, over the first lantern’s glass, Channel to 1, Radius to 40, Intensity to 0.35 and Color to 1.0, 0.7, 0.4.
  2. Add another Light under Hall and rename it cold_pocket. Leave Kind on Point. Set its Position to 40 and 320, the bottom-left corner, Channel to 2, Radius to 100, Intensity to 0.1 and Color to 0.5, 0.4, 0.2.
  3. Add a third Light under Hall and rename it moon. Leave Kind on Point. Set its Position to 314 and 40, above the window, Channel to 3, Radius to 16, Intensity to 1.0 and Color to 1.0, 0.9, 0.55.
  4. Press Ctrl+S.
The halo selected, its Inspector narrowed to its Light: Kind Point, Radius 40.00, Intensity 0.35, a warm Color, Direction x 0.0 and y 1.0, Angle 1.2, Sort Layer Default 0, Channel 1 with a dot marking it changed, and Softness 0.00; the Viewport draws a yellow circle of Radius 40 round the first lantern’s glass, and a small circle over the window’s top for the moon
Channel 0, Multiply
The room’s own lighting: lights add up, and the sum multiplies each sprite’s colour. Where every lamp belongs until one has to do something else.
Channel 1, Additive
Adds its light over the lit room, so it can brighten a wall past its own colour: a glow round a flame. For a halo, a Radius of 20 to 60 and an Intensity of 0.2 to 0.6 looks right; much more and the bricks wash out, and by 140 it fogs the whole patch.
Channel 2, Subtractive
Takes its colour away from the lit room: 0.5, 0.4, 0.2 takes more red than blue, and leaves a dark corner. A Radius of 60 to 150 and an Intensity of 0.1 to 0.25 looks right; at 0.03 it is hardly there.
Channel 3, Replace
Paints its colour over the room, as strongly as it reaches: full at its middle and nothing at its Radius. For a moon, a Radius of 12 to 32 is a small disc to a big one. Where two Replace lights overlap their colours still add, and the one drawn last decides how much of the room is replaced: the order is each light’s Sort Layer, from chapter 4.
The first lantern and its bricks without the halo: the glass plain yellow and the bricks round it their ordinary brown
Before: the first lantern without the halo.
The same lantern with the halo: a warm glow spreads from the lantern’s glass over the bricks round it, brightening them past their brown
After: the halo’s warm glow round the glass.
The bottom-left corner without the cold pocket: the floor caps and the wall below them in their ordinary dim blue-green, the first rune on the wall above
Before: the corner without the cold pocket.
The same corner with the cold pocket: the floor below the caps and the wall above them are almost black, the caps themselves still showing, darker than anything round it
After: the corner darker, where the pocket takes its colour away.
The top of the window and the arch above it with the moon placed on the glass: a faint yellow smudge on the glass, hardly there
For comparison, the moon on the window’s glass: it hardly shows.
The same view with the moon above the window, on the dark arch: a clear pale yellow disc with soft edges
The moon on the dark arch, where you put it.

Part 2 ends here

The hall now has shaped light: a cone, moonlight, stained glass, a shaft through the doorway, glowing glass and runes that answer to light. You can stop here. Part 3 gives the bricks depth, the flames life, a candle of your own, a glow, and a budget for a phone.

The glass, the runes and the three channels

The three lights, all Points, to build them again in your own game.

LightChannelRadiusIntensityColor
halo1 Additive400.351.0, 0.7, 0.4
cold_pocket2 Subtractive1000.10.5, 0.4, 0.2
moon3 Replace161.01.0, 0.9, 0.55

And the sprites.

SpriteSetting
The lanterns’ glass and the windowUnshaded ticked
The three runesLight Only ticked

Check it works