Spot Light
Conical lights for flashlights and stage.
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
Step-by-Step Guide
Follow these steps to work with spot light in your Appley project:
Add a light
In the hierarchy, add a light object (directional, point, spot) for spot light.
Configure properties
Set intensity, color, range, and direction in the inspector.
Enable shadows
Turn on shadow casting and configure shadow quality and distance.
Adjust ambient
Set ambient light to fill shadows and prevent overly dark areas.
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:
// 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:
[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
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
Scene is too dark
Shadows dont appear
Light baking takes too long
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.
Related Pages
Explore these related documentation pages:
Example Project
Download a complete example project demonstrating spot light:
