Skip to content

Tutorials · Light and Shadow · Chapter 6

Moonlight

15 minutes Uses: Light, Occluder

By the end

  • A Directional light, moonlight, washing the hall a cold blue
  • The pillars’ shadows slanting down and to the right, 120 units long
  • Why a Directional light has no position, and why its Radius is its shadows’ length
On this page

Light from far away

The sun and the moon are so far away that their light arrives in parallel, from one direction, and reaches everything in view at once. A Directional light is that: no middle, no edge, a wash over the whole scene, and shadows that all fall the same way. The hall’s moon shines in through the window.

  1. Select Hall, press + Add node, and choose Light. Rename it moonlight.
  2. Set its Position to 314 and 90, by the window, where the Viewport draws its arrow.
  3. Set Kind to Directional.
  4. Set Radius to 120, Intensity to 0.25 and Color to 0.5, 0.6, 1.0, alpha 1.
  5. Set Direction to 0.5 and 0.866.
  6. Press Ctrl+S.
The moonlight selected, its Inspector narrowed to its Light: Enabled ticked, Kind Directional, Radius 120, Intensity 0.25, a pale blue Color, Direction x 0.5 and y 0.866, Angle 1.2, Sort Layer Default 0, Channel 0 and Softness 0; the Viewport draws a short yellow arrow from the node, at the top of the window, down and to the right, with a square handle at its tip and another to the right of the node
The hall at the end of chapter 5: warm patches of brick round the first and second lanterns, the pillars with short shadows, the sconce’s pale wedge, and dark blue-green everywhere else
Before: chapter 5’s hall.
The same hall with the moonlight on: a cold blue wash over the wall and the floor, the window brighter, and long faint shadows slanting down and to the right from both pillars across the wall and the floor caps
After: the moonlight’s cold wash, and the pillars’ shadows slanting right.

In the Viewport a Directional light is a short arrow from its node along its Direction. The square at the arrow’s tip aims it, and a second square, as many units to the right of the node as the Radius, sets the Radius.

Direction, and a Radius that is a length

Kind Directional
Lights everything in view evenly, from one direction, with no middle to fade from. Its shadows are the only edges it has.
Direction
The way the light travels, as two numbers: across the screen, then down it. 0.5, 0.866 is down and to the right, thirty degrees from straight down, and every shadow falls that way. Which way it points is all that counts, not how long the two numbers are.
Radius
For a Directional light, how long its shadows are, in world units: 120 here. It does not say how far the light reaches, because it reaches everywhere. At 0 it lights nothing.
Intensity
How strong the wash is: 0.25 here, so the lanterns stay brighter than the moon and still read as the lights. 0.15 to 0.5 looks right, and 1.0 washes the whole hall a strong blue.
The right pillar and the floor caps beside it with the moonlight’s Radius at 20: a short dark stub of shadow at the pillar’s top right corner, and no shadow across the wall
For comparison, Radius 20: a stub of shadow.
The same pillar with the Radius at 60: a longer shadow slants from the pillar’s top right corner across the wall, its tip just above the floor caps
For comparison, Radius 60: the shadow’s tip reaches the top of the floor caps.
The same pillar with the Radius at 120: the shadow slants from the pillar across the wall, over the floor caps and down off the bottom of the picture
Radius 120, the value you set: the shadow runs across the floor caps and off the bottom of the window.
The whole hall with the moonlight’s Direction mirrored to -0.5, 0.866: the shadows of both pillars slant down and to the left across the wall and the floor caps
For comparison, Direction -0.5, 0.866: the shadows lean left.

The moonbeam

Every value of the light, to build it again in your own game.

FieldValue
KindDirectional
Direction0.5, 0.866
Radius120
Intensity0.25
Color0.5, 0.6, 1.0

Check it works