XESOFT Explore Argus
Unity AI field guide / Lighting

Light and Shadow Detection for Stealth Games in Unity

Add light-aware stealth detection in Unity using scene light sampling, occlusion checks, brightness multipliers, crouch-aware sample points, fair thresholds, and practical debugging.

7 minute read Updated August 14, 2026 By Xerav, creator of Argus
See the mechanicArgus: Light-Aware Detection micro-demo
01

Treat lighting as a detection multiplier

Darkness should rarely make a player completely invisible. Instead, estimate brightness at the player and use it to scale how quickly vision builds awareness. A guard can still detect a nearby silhouette in shadow, but the player receives more reaction time than they would under a bright lamp.

Multiplying detection strength preserves the rest of the vision model. Distance, angle, line of sight, posture, and concealment still matter, while lighting becomes one understandable factor rather than a second competing detection system.

02

Sample the lights that can actually reach the player

For each relevant directional, point, or spot light, estimate its contribution at the target. Account for range, angle, and falloff, then test whether geometry blocks the path from the light to the sample point. Combine the visible contributions and include a small ambient floor if the art direction requires it.

You do not need to read rendered shadow maps to produce useful stealth gameplay. A consistent approximation based on scene lights is easier to support across Built-in, URP, and HDRP and is straightforward to inspect during play.

03

Use the same body sample rules as vision

Brightness at the feet is not always representative of the visible body. Reuse the player standing and crouching sample points so the lighting estimate matches the point guards are trying to see. For larger characters, combine torso and head samples or select the brightest relevant point.

Keeping vision and lighting samples aligned avoids contradictory results such as the guard ray hitting the upper body while the darkness calculation reads a fully shadowed pivot at ground level.

04

Make darkness readable and bounded

Players need to understand when darkness is helping. A visibility meter, subtle vignette, character shader response, or HUD indicator can communicate the current multiplier. The effect should have a minimum and maximum so a tiny light does not reveal the player instantly and deep shadow does not grant absolute immunity.

Be explicit about exceptions. A guard who is extremely close, already in combat, standing inside the same hiding area, or watching the player enter cover may use different rules. Consistency matters more than realism.

Darkness is most satisfying when it buys time and options, not when it switches the AI off.

05

Budget light sampling separately from vision

Light queries and occlusion checks do not need to run every rendered frame. Sample on the same fixed sensor tick as awareness, cache nearby lights when practical, and skip lighting work for targets already rejected by range, angle, or line of sight.

Expose the raw brightness, each contributing light, each blocked light, the final multiplier, and the resulting time-to-detection. That makes both artistic tuning and performance work measurable.

The production-ready path

Argus already connects these pieces.

Argus packages perception, awareness, memory, suspicion, search, squad coordination, and live debugging into a drop-in Unity 6 system. Use the included guard or subscribe to its events and keep your existing movement, animation, combat, and character art.