Skip to main content

Lighting

Talesmith lights 2D scenes with point, spot and directional lights that cast soft shadows from shadow casters and tile maps. A scene's ambient light sets how dark it is before any light shines; lights add to it, and glowing sprites stay bright in the dark. This page covers the Lighting panel, ambient light and presets, lights and their settings, shadows and light layers, glowing sprites, cookies and flicker, and the quality settings.

Lantern Grove at night with Preview on. The campfire's light shows its radius and inner radius as gizmos.

Light a scene​

  1. Darken the scene: open the Lighting panel and click a preset such as Dusk or Night.
  2. Add a light: GameObject › 2D Object › Light › Point Light, or right-click an entity in the hierarchy and choose 2D Object › Light to add the light as its child.
  3. Set the light's Color, Intensity and Radius in the Inspector, or drag the radius handle in the viewport.
  4. Turn on Preview (CtrlAltP) to see flicker and pulse animations move.

A scene's ambient light starts as white at full intensity. Until you darken it, lights have little to show: a scene without lights or glowing sprites renders exactly as without lighting, and the renderer skips lighting altogether.

The Lighting panel​

The Lighting panel (Window › Panels › Lighting, or the Effects layout) shows the scene's lighting at a glance. The Inspector edits each light in detail.

A night scene with five lights, three shadow casters and a glowing window.
SectionWhat it shows
Ambient lightThe scene's ambient Color and Intensity: the light everywhere before lights add to it
PresetsReady-made looks, and Save current as preset…
QualityHow much lighting costs. See Quality.
LightsEvery light of the scene
Light layersWhich shadow caster layers block each shadow-casting light
Shadow castersEvery Shadow Caster 2D, with its shape, layer and switch
Glowing spritesEvery Emissive sprite, with its color, intensity and switch

Lighting off in the panel's header shows the viewport without lighting while you arrange things in a dark scene. It changes nothing in the scene and is not saved.

Presets​

PresetAmbient colorIntensity
Daywhite1
Golden hourwarm orange0.85
Overcastgrey blue0.75
Duskviolet0.5
Nightdark blue0.28
Dungeonnear black0.12

Clicking a preset sets the ambient light, as one undo step. Save current as preset… saves the ambient light, quality and lit layers as a .tlighting file in assets/lighting/; your presets appear after the built-in ones.

The light list​

Each light shows its name, type, radius and blend mode, with its color, intensity, shadows and an on/off switch you can change right there. Filter the list by name or by type with All, point, spot and directional buttons. Click a light's name to select it and frame it in the viewport.

S solos a light: the viewport shows that light alone, so you can see exactly what it lights. Click Clear solo in the header to see every light again. Soloing only affects the editor's view.

Lights​

A light is a Light 2D component. The entity's position is the light's center; spot and directional lights point along the entity's rotation.

TypeShines
PointIn every direction from a point: torches, lamps, fireflies
SpotIn a cone: street lamps, flashlights, stage lights
DirectionalEverywhere, from one direction, like the sun or the moon
FieldDefaultWhat it does
BlendAdditiveAdditive adds light. Mix replaces the light underneath with its color, faded by its falloff. Multiply darkens or tints, for fog of war or colored filters.
Colorwhite
Intensity1From 0 to 8. Light can brighten colors up to twice.
Radius256How far the light reaches, in world units. Directional lights reach everywhere.
Inner Radius0The part of the radius at full strength, from 0 to 1
Falloff1.6How quickly the light fades toward its radius: 1 is linear, higher concentrates it near the center
Spot Angle60°The full width of a spot light's cone
Spot Inner Angle30°The part of the cone at full strength
CookienoneAn image the light shines through, stretched across its radius and turned with it: window frames, leaves, a stained glass pattern

Selected lights show their radius, inner radius and cone as gizmos whose handles you can drag.

Flicker and pulse​

Under Animation, choose Flicker for fire and failing lamps, or Pulse for a slow, even throb, such as a magic crystal. Animation Speed sets how fast it changes (cycles per second for Pulse) and Animation Amount how much of the intensity it takes away at its lowest, 0.3 by default. Animations play in Preview and in the game.

Shadows​

Tick Casts Shadows on a light to have it throw shadows from:

  • Entities with a Shadow Caster 2D: a box, circle or polygon, placed relative to the entity. Add one to walls, trees, crates and characters.
  • The collision layers of tile maps: the opaque pixels of every solid cell's tile, or the collision shapes of its tile. See Collision and map objects.
Light fieldDefaultWhat it does
Shadow Strength1How dark the shadow is
Shadow Softness0.4How soft the edge is. The soft edge widens with the distance behind the caster, as real shadows do.
Shadow Length0For directional lights, how far shadows reach; 0 is unlimited
Shadow LayersEverythingWhich caster layers block this light

Shadows fall on what lies behind casters. A shadow caster stays lit, even in another caster's shadow, so a stack of crates or a row of platforms is lit evenly by the lights around it. Casters that touch block light as one shape. Tick Self Shadows on a caster to darken the caster itself too; other casters' shadows then darken it as well.

Light layers​

Every shadow caster is on a layer, 0 to 31. Each shadow-casting light chooses which layers block it, so a torch carried by the player can ignore the player's own caster while the moon still casts the player's shadow. The Light layers grid in the Lighting panel shows one row per shadow-casting light and one column per layer in use; click a cell to change whether that layer blocks that light. Tile map shadows are on the layer set by Tile layer in the panel's Quality section, 0 by default.

Glowing sprites​

Add an Emissive component to an entity with a sprite to keep the sprite bright in the dark: lit windows, lava, glowing eyes, a lantern's paper. Its Color tints the glow and its Intensity sets how bright: 1 shows the sprite at full brightness in complete darkness, 2 brightens it up to twice. Pair it with a light to make the sprite light its surroundings too.

Quality​

The Quality section of the Lighting panel sets how much lighting may cost, per scene:

QualityLight mapLightsShadowed lightsShadow detailShadow edgeShadow casters
Low¼ of the screen164256hard64
Medium (default)½328512soft256
Highfull64161024softer1024

Custom sets each limit yourself: Light map (its size relative to the screen), Lights, Shadowed lights, Shadow map (directions per light), Samples (1 gives hard shadows) and Casters. When a scene has more lights than the limit, the least important ones are left out each frame: dim, small and far from the center of the screen first.

SettingDefaultWhat it does
Lit belowOverlay (500)Render layers below this one are lit; it and the layers above, such as overlays and debug views, stay as drawn
Tile shadowsonWhether tile map collision layers cast shadows
Tile layer0The shadow caster layer tile map shadows are on

These settings and the ambient light are saved in the scene. Each render layer also has a Lit switch in the scene settings.

Performance​

Lights are culled against the camera and capped by the quality, so a scene can contain many more lights than are drawn at once. Shadow-casting lights cost the most: keep Casts Shadows for the lights where it shows. The Lighting panel's header counts the scene's lights and how many cast shadows. In a running game, the performance overlay (F3) and profiler reports (F9) show what lighting costs per frame. See Performance.