Skip to content

pekkavaa/vis.py

Repository files navigation

vis.py

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 portals of a simple example map. The rectangular portals of a simple example map.

Since this is single-threaded Python code, it runs very slowly :)

Structure

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.

Installation

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.

Usage

python vis.py data/example.prt data/example.bsp output.bsp

Credits

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).

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages