Shadow casting · Visibility polygon · NPC sight
Move NPC: drag green dot.
Add Box: click-drag to draw.
Drag boxes to reposition.
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.
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.
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.
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.