Install Asset
Install via Godot
To maintain one source of truth, Godot Asset Library is just a mirror of the old asset library so you can download directly on Godot via the integrated asset library browser
Quick Information
A dependency-free 2D visibility polygon (isovist) for Godot 4: computes the region an observer can see over a set of line segments, using a correct O(N log N) active-edge sweep that does not leak sight around corners. Useful for fog of war, 2D lighting/shadows, stealth line-of-sight, and visibility analysis. Includes an interactive demo scene. Algorithm ported from byronknoll/visibility-polygon-js (public domain).
Godot Visibility Polygon
A small, dependency-free Godot 4 addon that computes a 2D visibility polygon (isovist) from an observer over a set of line segments — the region visible from a point, given walls that block sight. Useful for fog of war, 2D lighting/shadows, stealth line-of-sight, and visibility analysis.
The lit (yellow) area is everything the red observer can see; each wall casts a crisp shadow behind it. In the demo scene the observer follows your mouse.
It uses a correct O(N log N) active-edge rotational sweep (a binary heap of segments ordered by distance from the observer, emitting a polygon vertex only when the nearest segment changes). Unlike a naive "cast a ray at every endpoint and connect the nearest hits by angle" sweep, it never lets a polygon edge cut across a wall — so it does not leak sight around corners into the next room.
The algorithm is a hand-port of byronknoll/visibility-polygon-js (public domain). Released under CC0 1.0 — do whatever you like with it, no attribution required (a star is appreciated).
Try it
Open this project in Godot 4.6+ and press Play — the demo scene draws the visibility polygon from your mouse over a few walls.
Install into your project
Copy the addons/visibility_polygon/ directory into your own project. The
library is a plain script — use it immediately via preload:
const VisibilityPolygon = preload("res://addons/visibility_polygon/visibility_polygon.gd")
var walls := [
[Vector2(0, 0), Vector2(100, 0)],
[Vector2(100, 0), Vector2(100, 100)],
[Vector2(100, 100), Vector2(0, 100)],
[Vector2(0, 100), Vector2(0, 0)],
]
var poly: PackedVector2Array = VisibilityPolygon.compute(Vector2(50, 50), walls)
Full API & docs
See addons/visibility_polygon/README.md
for the complete API (compute, compute_viewport, point_in_polygon,
fan_indices, convert_to_segments, break_intersections), usage notes, and
the segment-input convention.
License
CC0 1.0 Universal (public domain dedication) — see
addons/visibility_polygon/LICENSE.
Algorithm ported from byronknoll/visibility-polygon-js (public domain).
A dependency-free 2D visibility polygon (isovist) for Godot 4: computes the region an observer can see over a set of line segments, using a correct O(N log N) active-edge sweep that does not leak sight around corners. Useful for fog of war, 2D lighting/shadows, stealth line-of-sight, and visibility analysis. Includes an interactive demo scene. Algorithm ported from byronknoll/visibility-polygon-js (public domain).
Reviews
Quick Information
A dependency-free 2D visibility polygon (isovist) for Godot 4: computes the region an observer can see over a set of line segments, using a correct O(N log N) active-edge sweep that does not leak sight around corners. Useful for fog of war, 2D lighting/shadows, stealth line-of-sight, and visibility analysis. Includes an interactive demo scene. Algorithm ported from byronknoll/visibility-polygon-js (public domain).