Hazel

Lighting

Light decides how your game feels more than almost anything else. This page covers the lights you can place, how shadows work and how to fix them when they look wrong, and the switches for bounce light and ray tracing.

Outdoors, most of your light comes from the sun, which lives on the World Environment entity together with the sky. See Environment for the sun, sky, fog and camera picture settings.

Adding a light

Click Add Entity in the Hierarchy's header (or right-click in the Hierarchy) and pick a light; typing its name in the search box finds it quickly.

LightWhat it is good for
Directional LightLight from very far away that falls on everything from the same direction, like the sun. Its position does not matter, only which way it points.
Point LightA bulb that shines in every direction: lamps, torches, glowing pickups.
Spot LightA cone of light: torches, headlights, stage lights.
Rect LightA glowing rectangle: windows, screens, soft studio lights.
Ambient LightA flat fill light everywhere, with no direction and no shadows. Use it sparingly; it flattens the scene.
Reflection ProbeNot a light, but it gives shiny surfaces inside its box something to reflect.

The Lighting group in the Add Entity window

Select a light and its settings appear in the Inspector.

Light settings

FieldLightsWhat it does
ColorallThe colour of the light.
IlluminanceDirectionalHow bright, in lux. A bright clear day is around 100,000.
IntensityPoint, Spot, RectHow bright, in lumens.
RangePoint, Spot, RectHow far the light reaches. Things beyond it get nothing from this light, so a smaller range is also cheaper.
RadiusPoint, SpotThe size of the bulb. Bigger makes shadows softer (with Soft Shadows on) and highlights on shiny things larger.
Inner Angle, Outer AngleSpotThe cone. Inside the inner angle the light is full strength; it fades to nothing at the outer angle.
Width, HeightRectThe size of the glowing rectangle.
BrightnessAmbientHow strong the fill light is.

A Point Light's settings in the Inspector: Color, Intensity, Range, Radius and the Shadows group

Shadows

Every light can cast shadows. In the light's section of the Inspector, Shadows is a group: its switch is in the group's row, and the settings that shape the shadow are folded inside it.

Shadows cost time to draw. A shadowed spot light renders the scene once more, and a point light six more times (one per side of a cube), so give shadows to the lights where you will see them and leave them off small fill lights.

Contact Shadows fills in the tiny shadows where things meet: a cup on a table, the gap under a door, a chair leg on the floor. Those are too small for a normal shadow to catch. They are cheap, but they can only see what is on screen.

When shadows look wrong

Two problems come up with every shadow:

  • Shadow acne: stripes or speckles of shadow on a surface that should be lit. Raise Shadow Depth Bias or Shadow Normal Bias a little.
  • Floating shadows: the shadow starts a little way away from the object, so it seems to hover. Lower the same two values.

Try Shadow Normal Bias first on curved or steep surfaces. Point and spot lights also have Shadow Near Plane: nothing closer to the light than this casts a shadow, and raising it as far as your scene allows makes shadows sharper.

Sun and directional light shadows

A directional light covers everything from your feet to the horizon, so its shadow is split into slices called cascades: the nearest slice gets fine detail, the far ones get coarse detail where you cannot tell. The settings are in the Cascades group inside Shadows.

FieldDefaultWhat it does
Shadow Cascades4How many slices, 1 to 4. Fewer is cheaper; a fixed top-down camera often looks fine with 1 or 2.
Shadow Distance150Nothing further from the camera than this gets shadows. Lower it to spend the same detail on a smaller area: a close third-person game gets much crisper shadows at 40 to 60.
First Cascade Distance10Where the sharpest slice ends.
Cascade Blend0.2How much neighbouring slices overlap, so you do not see a line where one hands over to the next.

Soft shadows

A real shadow is sharp where an object touches the ground and blurrier the further it falls from it. Soft shadows reproduce that.

  • On a directional light, Soft Shadow Size turns them on: 0 gives hard shadows, and anything above 0 is the size of the light. Around 0.3 to 1.5 suits a sun.
  • On point and spot lights, turn on Soft Shadows and set the blur with Radius.

Soft shadows are grainy on their own and need the camera's anti-aliasing set to TAA to smooth them out (new cameras start on TAA). They cost more than hard shadows.

Shadow detail and graphics quality

How detailed sun shadows are depends on the project's Graphics Quality (Project settings, under 3D Rendering): High draws them at 2048 pixels per slice, Medium at 1024 and Low at 512.

God rays

To get visible beams of light through fog or dust, add the Volumetric Light component to the light, then add a Fog Volume for the beams to show in. The World Environment's sun already has Volumetric Light. See Environment.

Reflection probes

Shiny surfaces reflect the sky by default. Indoors, that looks wrong: a polished floor in a dark corridor should not reflect a blue sky. A Reflection Probe gives everything inside its box a different image to reflect.

FieldWhat it does
Source (HDR / Cube)The image to reflect: a panorama (.hdr, .exr, .png) or a cube map (.ktx2, .dds).
IntensityHow strong the reflections are.
FalloffHow softly the probe fades out towards the edge of its box.
Parallax CorrectionAuto lines the reflection up with the box, so a room's reflection sits on its walls instead of floating at infinity. Custom lets you set the box size yourself.

Scale the probe's box with its Transform to fit the room.

Bounce light

In real life light bounces: a red wall tints the floor beside it red, and a sunlit floor lights up the ceiling. Two options on the World Environment add this.

SSIL

SSIL (screen-space indirect lighting) adds bounce light between nearby surfaces, using only what is on screen. It is cheap, needs no special graphics card, and is on by default on a new World Environment.

FieldWhat it does
IntensityHow much light bounces.
OcclusionHow much corners and crevices darken.
RadiusHow far light bounces, in metres.

It needs the project to use deferred rendering (Project settings, 3D Rendering, Mode), and only runs on the High graphics quality.

Solari ray-traced lighting

Solari Ray-Traced GI traces real rays of light through your scene, for bounce light, soft shadows and reflections that are close to what you would see in life. Nothing is baked: move a light or a wall and the lighting follows at once. It needs a graphics card with hardware ray tracing, and it is the most expensive thing in the frame, so it starts switched off. Turn it on with its switch on the World Environment. While it is on, SSIL turns itself off, because Solari already does that job.

FieldWhat it does
QualityLow, Medium, High or Ultra. Higher is less grainy and costs more.
ReSTIRShares light samples between nearby pixels and recent frames, which removes a lot of grain for little cost. The Quality setting picks it for you; this overrides it.
Glass ReflectionsGlass and glossy coats reflect the scene around them. Off, they reflect only the sky.
DenoiserWhat cleans up the grain: DLSS (if available), Built-in, or Off (raw) to see the raw result.
ResolutionHow sharp the traced lighting is, from Native down to Performance. Lower is faster.
Reset Temporal HistoryClears the lighting built up over recent frames. Use it after a camera cut if you see dark trails.

Under Advanced, Point/Spot Light Proxies lets point and spot lights take part in the ray-traced lighting.

The Ray Tracing panel shows what Solari is doing: how many rays it fires, how much grain the denoiser removes and how long it takes each frame. It is for checking performance, not something you need day to day.

DLSS

On an NVIDIA RTX card, DLSS can clean up Solari's grain (pick it as the Denoiser) and can also be chosen as the camera's anti-aliasing method. If the DLSS files are not installed yet, the Solari section shows an Install DLSS button that downloads them; restart the editor afterwards. On a card or build that cannot run DLSS, a note says so and the built-in option is used instead.

Next steps

  • Set up the sun, sky and camera look in Environment.
  • Make surfaces glow, shine or look rough in Materials.