KROYSDOCS
HomeWhat's newv0.1.0
MANUAL / Editor / Lighting and rendering

Lighting and rendering

Lights use physical units, a camera exposure turns scene light into the picture, reflection probes and probe volumes give rooms their own reflections and indirect light, and a quality preset decides anti-aliasing, ambient occlusion and other costs.

PanelsLighting, Inspector
ComponentsDirectional, Point, Spot Light, Reflection Probe, Probe Volume
BakeTasks panel
QualityProject Settings, Preferences
01

Light units

One scene light unit is 1000 photometric units, so everyday values stay small numbers.

LightIntensity meansTypical values
Directional Lightilluminance in kiloluxovercast 1 - 2, sunlight 50 - 100
Point and Spot Lightluminous intensity in kilocandela60 W bulb 0.07, flood light 2 - 10
Environment map, emissive materialsluminance in kilonitclear sky 2 - 8

Point and spot lights fall off with the inverse square of the distance (Inverse Square Falloff) and fade to zero at their Range. Lights from older scenes keep their old falloff until you switch it on.

Light units: The moonlight, a directional light in the editor
02

Exposure

Lighting > Post Processing > Exposure Mode decides how bright the scene looks:

  • Multiplier: the scene light times Exposure (older scenes).
  • Manual EV100: a camera exposure value. Sunny day about 15, overcast 12, interiors 7 - 9.
  • Auto: measures the picture every frame and adapts within Auto Exposure Min/Max EV100 at the Speed Up and Speed Down rates.

Exposure Compensation brightens (+1 doubles) or darkens in every mode. Tone Mapper ACES Filmic is the recommended curve for new content: bright saturated colours roll off towards white instead of clipping.

Exposure: Exposure and Tone Mapper in the editor
03

Reflection probes

Outdoors, shiny surfaces reflect the sky. Indoors that looks wrong: a polished floor should reflect the room. A Reflection Probe captures its surroundings and replaces the sky's reflections and ambient light for everything inside its box.

  1. Add an entity in the middle of the room and give it a Reflection Probe component (Lighting). Place it where an observer would stand; the capture is taken from the entity's origin.
  2. Set Box Extents (half size) and Box Offset so the box matches the room's walls. The box follows the entity's rotation and scale.
  3. Click Bake in the inspector, or Bake All Reflection Probes (also in the command palette). A Bake task in the Tasks panel shows the progress. The capture is saved in Content/Lighting/ReflectionProbes and ships with the game; baking is one undo step.
SettingEffect
Blend DistanceFades the probe out over this band inside the box faces, for soft transitions between rooms and to the sky.
PriorityWhere boxes overlap the higher priority wins; at equal priority the smaller box wins.
Parallax CorrectionProjects reflections onto the box, so a box-shaped room's reflections line up with its walls. Turn it off for open areas.
IntensityScales the captured light.
Capture On StartThe running game captures the probe again when it starts (scenes that change before play).

A running game also captures, once, every enabled probe that was never baked. Scripts and tools can set Capture Requested to capture a probe again; capturing pauses the GPU briefly once per face, so do it during loading. Probes do not see water surfaces, and up to eight probes shade any one view.

Scripts can ask for a new capture too: ReflectionProbe.SetBakeRequested(true) on the probe's entity (C#), which the running game picks up on the next frame.

Reflection probes: Add the probe entity in World in the editor
04

Probe volumes

A reflection probe gives a whole room one ambient light. A Probe Volume gives it light that changes across the room: brighter near a sunlit window, darker under a table, coloured by a red wall. It holds a grid of small light probes over a box; surfaces inside the box take their indirect diffuse light from the nearest probes instead of the sky.

  1. Add an entity and give it a Probe Volume component (Lighting). Set Box Extents and Box Offset so the box covers the area, floor and walls included (surfaces outside the box are not lit by it; the probes themselves sit at cell centres, inside the box).
  2. Choose the grid with Probes X/Y/Z: about one probe per metre is a good start (the inspector shows the total).
  3. Click Bake (or Bake All Probe Volumes, also in the command palette). A Bake task renders six small views at each probe and shows the progress per probe. The result is saved in Content/Lighting/ProbeVolumes, ships with the game, and baking is one undo step.
SettingEffect
Blend DistanceFades the volume out over this band inside the box faces, into the sky or a neighbouring volume.
Normal BiasMoves the lookup along the surface normal (in cells) so surfaces do not darken themselves.
IntensityScales the baked light.
PriorityWhere volumes overlap the higher priority wins; at equal priority the smaller box wins.

Rebake after moving walls or lights. Without a bake, and outside every box, surfaces use the sky and reflection probes as before. Probes see one bounce of light; keep probes out of walls (they would see black), and remember thin walls between probes can let light through. Up to four volumes shade a view. Scripts can set ProbeVolume.SetBakeRequested(true) to bake one for the running game.

Probe volumes: Add the volume entity in World in the editor
05

Ambient occlusion

Corners, creases and the ground under objects receive less sky light. Screen-space ambient occlusion finds them every frame from the depth of the picture and darkens the indirect light there (sky, reflection probes, probe volumes), never direct light from lamps or the sun.

Lighting > Post Processing > Ambient Occlusion: AO Radius is how far (in metres) a surface looks for occluders, AO Intensity how strongly they darken. The quality preset decides the resolution and how many samples are taken; Low turns it off.

Ambient occlusion: Post Processing in the editor
06

Anti-aliasing

The quality preset chooses the anti-aliasing:

  • TAA (Medium, High, Ultra): every frame is rendered with a slightly shifted camera and blended with the previous frames, which smooths edges and fine detail. Particles, effects and glass tell it to use the current frame, so they never smear; the game's UI is drawn afterwards and stays sharp. It restarts after camera cuts and resizes.
  • FXAA (Low): a single-frame edge filter on the final image, cheaper and softer.
Anti-aliasing: Viewport in the editor
07

Post-processing

Lighting > Post Processing holds the camera and the look of the picture, applied in this order:

GroupWhat it does
ExposureSee Exposure.
BloomLight brighter than Threshold (scene units, before exposure) glows; Soft Knee softens the threshold (0 - 1), Intensity scales the glow, Radius widens it, Iterations sets how far it spreads. Off on Low quality.
Tone MapperMaps scene light to the display; ACES Filmic is recommended.
Atmospheric FogDistance and height fog, optionally lit by the sun.
Contrast, Saturation, TintColour grading of the final picture.
VignetteDarkens the corners.
Ambient OcclusionSee Ambient occlusion.

Debug View shows the scene before grading (Raw Scene Color) or its depth.

Post-processing: Post Processing in the editor
08

Quality presets

One preset sets the rendering costs of the whole game: Low, Medium, High (default) or Ultra.

LowMediumHighUltra
Anti-aliasingFXAATAATAATAA
Ambient occlusionoffhalf resolutionhalf resolution, more samplesfull resolution
Shadow map size (at most)1024204840964096
Sun shadow cascades (at most)2344
Bloomoffononon
  • The game's default: Project Settings > Runtime > Quality Preset. New projects start on High.
  • Your editor: Preferences > Game Preview > Rendering Quality overrides it on this machine only.
  • Players: start the game with --quality Low (or Medium, High, Ultra), or put a line quality_preset=Medium in graphics.cfg in the game's user settings folder (Games/<project name>).
Quality presets: Lighting in the editor

KroysEngine 0.1.0 documentation, built from the engine repository by Tools/BuildDocsSite.py.