This is tool computes a potentially visible set (PVS) for a Quake map. It converts a portal file (PRT) to a leaf-to-leaf visibility matrix that is written to a map BSP file. It needs other map tools to work.
I've written a detailed explanation of the algorithm in the Demystifying the PVS series on my blog.
The rectangular portals of a simple example map.
Since this is single-threaded Python code, it runs very slowly :)
The main algorithm is in the vis.py
file. 3D clipping calculations and separating plane selection are in clipper.py
. Input and output are handled in prt_format.py
and bsp_format.py
, respectively.
pip install -r requirements.txt
The only real dependency is NumPy. Matplotlib is used for 3D visualization but can be omitted with the --noviz
commandline flag.
Tested with Python 3.9.9.
python vis.py data/example.prt data/example.bsp output.bsp
This code is a Python reimplementation of the algorithms in the original vis
tool and the updated version in ericw-tools.
Some Quake BSP utilities adapted from Matthew Earl's pyquake library.
License: MIT No Attribution (MIT-0).