AppleyAppley Docs
Docs/Lighting

Spot Light

Conical lights for flashlights and stage.

8 min read Intermediate Updated 2026-07-01 v2.0 ~23 min to complete

Introduction

Conical lights for flashlights and stage. This page provides a complete guide to spot light in Appley, covering everything from setup to advanced techniques.

Lighting is a core area of Appley. Understanding spot light will help you build better games and use the platform more effectively. This documentation is designed for intermediate level users.

Requirements

Before working with spot light, ensure you have the following:

  • An Appley project with a 3D scene
  • Understanding of light types (directional, point, spot)
  • HDR environment maps (optional)
  • Basic knowledge of shadows and baking

Estimated Completion Time

This guide takes approximately 23 minutes to complete. The estimated reading time is 8 minutes. Difficulty level: Intermediate.

Step-by-Step Guide

Follow these steps to work with spot light in your Appley project:

1

Add a light

In the hierarchy, add a light object (directional, point, spot) for spot light.

2

Configure properties

Set intensity, color, range, and direction in the inspector.

3

Enable shadows

Turn on shadow casting and configure shadow quality and distance.

4

Adjust ambient

Set ambient light to fill shadows and prevent overly dark areas.

5

Test and bake

Preview the lighting in play mode. Bake static lights for performance.

FluxScript Example

Below is an Appley Scripting (Flux Scripting) code example demonstrating spot light:

Spot Light — Appley Scripting
// Lighting — Spot Light
on start {
  sun = lighting.add("directional")
  sun.setIntensity(1.2)
  sun.setColor(255, 240, 220)
  sun.setDirection(-0.5, -1.0, -0.3)
  sun.setShadows(true, { quality: "high", distance: 100 })
  
  torch = lighting.add("point")
  torch.setPosition(10, 5, 10)
  torch.setIntensity(2.0)
  torch.setRange(15)
  torch.setColor(255, 180, 100)
}

on update(dt) {
  time = world.getTime()
  sunIntensity = 1.2 * math.sin(time * 0.26)
  sun.setIntensity(math.max(0.1, sunIntensity))
}

Node Script Example

The same logic can be implemented using Node Scripting. Here is the equivalent node graph:

Spot Light — Node Graph
[On Start] ──► [Add Light: directional]
         ──► [Set Intensity: 1.2]
         ──► [Set Shadows: high]

[On Update] ──► [Get Time] ──► [Sin] ──► [Max: 0.1]
                            ──► [Set Sun Intensity]

Interchangeable Systems

FluxScript and Node Scripting compile to the same runtime. You can mix both in a single project — use whichever is best for each task.

Common Mistakes

Avoid these frequent mistakes when working with spot light:

Using too many real-time lights

Limit to 2-3 dynamic lights. Bake the rest into lightmaps.

Not setting light range appropriately

Set range to just cover the needed area to reduce GPU cost.

Enabling shadows on all lights

Only the main directional light and key spot lights need shadows.

Using extremely high shadow distances

Keep shadow distance to 50-100 units for quality and performance.

Troubleshooting

If you encounter issues with spot light, try these solutions:

Shadows are blocky/low quality
Increase shadow map resolution. Reduce shadow distance. Use higher quality.
Scene is too dark
Add ambient light. Increase directional light intensity. Check tone mapping.
Shadows dont appear
Ensure shadow casting is enabled on the light. Objects must have cast shadows.
Light baking takes too long
Reduce lightmap resolution. Bake fewer lights. Simplify geometry.

Performance Tips

Optimize your use of spot light with these performance tips:

  • Bake static lighting into lightmaps for environments that dont change.
  • Use only 1-2 real-time shadow-casting lights per scene.
  • Set appropriate light ranges to avoid unnecessary GPU computation.
  • Use HDR environment maps for realistic ambient lighting.

Explore these related documentation pages:

Example Project

Download a complete example project demonstrating spot light: