Lighting Basics
Set up scene lighting to make your game look great.
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
Screenshot
Step-by-Step Guide
Add a Directional Light
Right-click in the hierarchy, select "Add Light > Directional". This simulates sunlight — parallel rays from a direction.
Set sun direction
In the Inspector, adjust the light's rotation to point downward at an angle. A 60° elevation gives pleasant daytime lighting.
Enable shadows
Check "Cast Shadows" in the light properties. Set shadow quality to Medium for a balance of quality and performance.
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.
Add a Point Light
For indoor scenes or torches, add a Point Light. Set its position, range (how far it reaches), and intensity.
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 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:
[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
Watch Out
