👁️ Field of View

Shadow casting · Visibility polygon · NPC sight

Mode

Move NPC: drag green dot.
Add Box: click-drag to draw.
Drag boxes to reposition.

FOV Parameters

Stats

Rays cast
Visible %
Player seen

👁️ Field of View — NPC Visibility

Interactive field-of-view simulation using shadow casting. Place obstacles in the scene, adjust the FOV cone angle and vision range, and watch the visibility polygon recalculate in real time.

🔬 What It Demonstrates

Shadow casting algorithms compute a visibility polygon by tracing rays from the NPC position and trimming them at obstacle edges. The result is a precise FOV that correctly handles partial occlusion, corners and overlapping obstacles.

🎮 How to Use

Drag the NPC around the scene. Click to place or remove obstacles. Adjust the FOV angle slider (30°–360°) and range. The visibility polygon updates instantly — bright areas are visible, dark areas are hidden.

💡 Did You Know?

Field-of-view algorithms are fundamental in stealth games (Metal Gear Solid, Hitman). Many roguelikes use the recursive shadowcasting variant that processes the grid octant-by-octant for maximum performance.