Glow mapping

From EDukeWiki
Jump to navigation Jump to search

Glow mapping is one of the new engine features in EDuke32. It uses hardware multitexturing to combine a regular texture map with a glow texture that'll be displayed fullbright.

DEF syntax to define glow maps inside model or texture blocks :

glow { file filename surf surface}

where filename is a regular double-quoted texture complete path and surface the surface id you want to work with if you're dealing with MD3s.

Example of a glow map definition :

Get to the Pig Cop model definition in the monsters.def file included with the HRP :

model "highres/sprites/monsters/2000_pigcop.md3" {
   scale 17 shade 0
   skin { pal 0 file "highres/sprites/monsters/2000_pigcop.png" }
   detail { file "highres/textures/detail.jpg" scale 0.4 }
   anim { frame0 "WALK1" frame1 "WALK2" fps 18 flags 0 }
   frame { name "WALK1" tile0 2000 tile1 2019 }
   anim { frame0 "SHOOT3" frame1 "SHOOT4" fps 20 flags 1 }
   frame { name "SHOOT3" tile0 2025 tile1 2027 }
   frame { name "SHOOT1" tile0 2030 tile1 2034 }
   anim { frame0 "SHOOT2" frame1 "SHOOT3" fps 14 flags 1 }
   frame { name "SHOOT2" tile0 2035 tile1 2037 }
   anim { frame0 "DIVE1" frame1 "DIVE2" fps 20 flags 1 }
   frame { name "DIVE1" tile0 2040 tile1 2044 }
   frame { name "DIVE2" tile0 2045 tile1 2049 }
   anim { frame0 "DSHOOT1" frame1 "DSHOOT2" fps 21 flags 0 }
   frame { name "DSHOOT1" tile0 2050 tile1 2052 }
   anim { frame0 "DIE1" frame1 "DIE2" fps 10 flags 1 }
   frame { name "DIE2" tile0 2055 tile1 2055 }
   anim { frame0 "DIE2" frame1 "DIE3" fps 20 flags 1 }
   frame { name "DIE2" tile0 2056 tile1 2060 }
}

Add a glow map definition line so it looks like that :

model "highres/sprites/monsters/2000_pigcop.md3" {
   scale 17 shade 0
   skin { pal 0 file "highres/sprites/monsters/2000_pigcop.png" }
   glow { file "highres/sprites/monsters/2000_pigcop_glow.png" }
   detail { file "highres/textures/detail.jpg" scale 0.4 }
   anim { frame0 "WALK1" frame1 "WALK2" fps 18 flags 0 }
   frame { name "WALK1" tile0 2000 tile1 2019 }
   anim { frame0 "SHOOT3" frame1 "SHOOT4" fps 20 flags 1 }
   frame { name "SHOOT3" tile0 2025 tile1 2027 }
   frame { name "SHOOT1" tile0 2030 tile1 2034 }
   anim { frame0 "SHOOT2" frame1 "SHOOT3" fps 14 flags 1 }
   frame { name "SHOOT2" tile0 2035 tile1 2037 }
   anim { frame0 "DIVE1" frame1 "DIVE2" fps 20 flags 1 }
   frame { name "DIVE1" tile0 2040 tile1 2044 }
   frame { name "DIVE2" tile0 2045 tile1 2049 }
   anim { frame0 "DSHOOT1" frame1 "DSHOOT2" fps 21 flags 0 }
   frame { name "DSHOOT1" tile0 2050 tile1 2052 }
   anim { frame0 "DIE1" frame1 "DIE2" fps 10 flags 1 }
   frame { name "DIE2" tile0 2055 tile1 2055 }
   anim { frame0 "DIE2" frame1 "DIE3" fps 20 flags 1 }
   frame { name "DIE2" tile0 2056 tile1 2060 }
}

Get this glow texture I made for the Pig Cop and save it as 2000_pigcop_glow.png in the highres/sprites/monsters directory :

2000 pigcop glow.png

As you can see it's just the original Pig Cop skin with only the eyes being opaque : that's how glow mapping works, anything that's not 100% translucent gets pasted on the regular diffuse map and displayed fullbright. Make sure glow mapping is enabled in the advanced graphics option menu (or just type r_glowmapping 1 in the console), fire up E1L2 and see the result on the underground passage Pig Cop :

Glowingpigcop.jpg

Hell yeah !

Glow mapping also works on regular texture replacements, allowing to replicate all fullbright effects from classic mode.