AppleyAppley Docs
Docs/Learning Paths

Lighting Basics

Set up scene lighting to make your game look great.

24 min read Beginner Updated 2026-07-01 v2.0 ~68 min to complete

Introduction

Lighting is what makes a 3D scene look real or stylized. This tutorial covers the three core light types and how to set them up for a well-lit scene.

Tutorial 16 of 18

This is part of the Beginner Learning Path. Estimated completion time: 68 minutes. Difficulty: Beginner.

Screenshot

Lighting Basics
Lighting Basics

Step-by-Step Guide

1

Add a Directional Light

Right-click in the hierarchy, select "Add Light > Directional". This simulates sunlight — parallel rays from a direction.

2

Set sun direction

In the Inspector, adjust the light's rotation to point downward at an angle. A 60° elevation gives pleasant daytime lighting.

3

Enable shadows

Check "Cast Shadows" in the light properties. Set shadow quality to Medium for a balance of quality and performance.

4

Add Ambient Light

Add an Ambient Light to fill in dark shadows. Set it to a soft sky blue (180, 200, 230) at 30% intensity.

5

Add a Point Light

For indoor scenes or torches, add a Point Light. Set its position, range (how far it reaches), and intensity.

6

Test in Play mode

Press Play to see the lighting in action. Adjust intensity and color until the scene looks right.

FluxScript Example

Here is the FluxScript (Appley Scripting) code for this tutorial:

Lighting Basics — FluxScript
// Lighting setup from script
on start {
  // Main sunlight (directional)
  sun = lighting.add("directional")
  sun.setIntensity(1.2)
  sun.setColor(255, 240, 220)  // Warm sunlight
  sun.setDirection(-0.5, -1.0, -0.3)
  sun.setShadows(true, { quality: "medium", distance: 80 })
  
  // Ambient fill light
  ambient = lighting.add("ambient")
  ambient.setIntensity(0.3)
  ambient.setColor(180, 200, 230)  // Soft sky blue
  
  // Torch point light
  torch = lighting.add("point")
  torch.setPosition(10, 3, 5)
  torch.setIntensity(2.0)
  torch.setRange(12)
  torch.setColor(255, 180, 80)  // Warm orange
  torch.setShadows(true, { quality: "low" })
}

// Flickering torch effect
on update(dt) {
  torch = lighting.find("point", 0)
  if torch != null {
    flicker = 1.8 + math.sin(time * 20) * 0.2 + math.random(0.1)
    torch.setIntensity(flicker)
  }
}

Node Script Equivalent

Prefer visual programming? Here is the same logic as a Node Script graph:

Lighting Basics — Node Graph
[On Start] ──► [Add Light: directional]
         ──► [Set Intensity: 1.2] ──► [Set Color: warm]
         ──► [Set Direction] ──► [Set Shadows: medium]
         ──► [Add Light: ambient]
         ──► [Set Intensity: 0.3] ──► [Set Color: sky blue]
         ──► [Add Light: point]
         ──► [Set Position] ──► [Set Range: 12]
         ──► [Set Color: orange]

[On Update] ──► [Find Light: point]
            ──► [Sin: time*20] ──► [Random: 0.1]
            ──► [Set Intensity: flicker]

Pro Tip

Bake static lighting into lightmaps for environments that don't change. Real-time lighting is expensive — limit it to 2-3 dynamic lights per scene.

Watch Out

Too many real-time shadow-casting lights will destroy your frame rate. Only the main directional light and key point lights should cast shadows. Keep it to 1-2 shadow casters max.