From ZDoom Wiki
Jump to navigation Jump to search
Graficon.gif Warning: This feature is GZDoom specific, and is not compatible with ZDoom!
To see all of GZDoom's specific features, see GZDoom features.
For more information on this article, visit the ZDRay page on the Doom Wiki.

ZDRay was a experimental lightmapping utility and node builder by Magnus Norddahl (dpJudas). It is based on ZDBSP for the node generation and lightmapping code from Strife: Veteran Edition called DLIGHT. It allows lightmaps and shadows to be baked in a WAD file. Unlike dynamic light however, baked lights generated by ZDRay are static, but they can have multiple bounces and support surface based area lights.

The utility was abandoned when issues arose regarding the lighting of sprites along with supporting all the slope variations that ZDoom allows, which was requested by Graf Zahl. A compiled version of the tool exists, along with a custom GZDoom build that supports ZDRay.


In order to use ZDRay, you make your map in the GZDoom Builder-Bugfix variant of Doom Builder 2, although Ultimate Doom Builder may also work. ZDRay picks up certain UDMF properties from the map itself and sunlight properties from MAPINFO. In order to get baked lights, you will have to place them in your level first. You either set your lights in Doom Builder to static, or you tag surfaces (sectores or lines; UDMF only) to be light emitters.

A possible workflow is to place dynamic lights first, and then convert these lights over to UDMF static lights, which you will have to do by hand.

Several restrictions are in play: Not all ZDoom slopes are supported, and sprites may not get correctly lit. A lightconfig.txt file needs to be created prior to using ZDRay. It can be empty, but you must at least insert 1 line.

Lastly, baking lightmaps and shadows is a costly CPU-intensive process. If you have a complex map with hundreds of static lights, expect compilation time to be significant. Since ZDRay uses the CPU to calculate the lightmaps, dedicating more CPU cores to the baking process will decrease the compilation time.


When using ZDRay, the following parameters are available:

Usage: zdray [options] sourcefile.wad
  —m, --map=MAP              Only affect the specified map
  -o, --output=FILE          Write output to FILE instead of tmp.wad
  -c, --comments             Write UDMF index comments
  -q, --no-prune             Keep unused sidedefs and sectors
  -N, --no-nodes             Do not rebuild nodes
  -g, --gl                   Build GL-friendly nodes
  -G, --gl-matching          Build GL-friendly nodes that match normal nodes
  -x, --gl-only              Only build GL-friendly nodes
  -5, --gl-v5                Create v5 GL-friendly nodes (overriden by -z and -X)
  -X, --extended             Create extended nodes (Including GL nodes, if built)
  -z, --compress             Compres the nodes (Including GL nodes, if built)
  -Z, --compress-normal      Compress normal nodes but not GL nodes
  -b, --empty-blockmap       Create an empty blockmap
  -r, --empty-reject         Create an empty reject table
  -R, --zero-reject          Create a reject table of all zeroes
  -E, --no-reject            Leave reject table untouched
  -p, --partition=NNN        Maximum segs to consider at each node (default 64)
  -s, --split-cost=NNN       Cost for splitting segs (default 8)
  -d, --diagonal-cost=NNN    Cost for avoiding diagonal splitters (default 16)
  -P, --no-polyobjs          Do not check for polyobject subsector splits
  -j, --threads=NNN          Number of threads used for raytracing (default 2)
  -Q, --samples=NNN          Set texel sampling size (lowest = higher quality but
                             slow complile time) must be in powers of two
  -S, --size=NNN             lightmap textures dimensions for width and height
                             must be in powers of two (1, 2, 4, 8, 16, etc)
  -M, --multisample=NNN      Number of samples to use per texel (default 1)
  -w, --warn                 Show warning messages
  -t, --no-timing            Suppress timing information
  -V, --version              Display version information
      --help                 Display this usage information

External links