ZDRay

From DoomWiki.org

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.

Usage[edit]

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. This can be done in two ways:

  • You set your lights in Doom Builder to static
  • 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.

You can then run your level through ZDRay and lights are then baked. The custom GZDoom build will then be able to read the data to draw complex shadows. This is similar to the workflow of creating lightmaps in Quake or Unreal.

Limitations[edit]

ZDRay poses several restrictions, some of which are inherent on using an offline lightmap renderer:

  • 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
  • Won't work on all ZDoom slopes
  • Sprites may not get correctly lit
  • Setting up lights needs to be done manually in-editor
  • You need to manually key in unsupported args into the things on the map
  • You must create a lightconfig.txt file. It can be empty but you must at least insert 1 line
  • Shadows are static, meaning that moving lifts or doors will not cast shadows

Parameters[edit]

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

ZDRay UDMF properties[edit]

linedef
{
	lightcolor = <int> (color, default: white)
	lightintensity = <float> (default: 1)
	lightdistance = <float> (default: 0, no light)
}

thing
{
	lightcolor = <int> (color)
	lightintensity = <float> (default: 1)
	lightdistance = <float> (default: 0, no light)
	lightinnerangle = <float> (default: 180)
	lightouterangle = <float> (default: 180)
}

sector
{
	lightcolorfloor = <int> (color, default: white)
	lightintensityfloor = <float> (default: 1)
	lightdistancefloor = <float> (default: 0, no light)

	lightcolorceiling = <int> (color, default: white)
	lightintensityceiling = <float> (default: 1)
	lightdistanceceiling = <float> (default: 0, no light)
}

External links[edit]