# high-level pseudocode palette = read_playpal(wad) pnames = read_pnames(wad) textures = read_texture_lump(wad, 'TEXTURE1') for tex in textures: canvas = new_image(tex.width, tex.height, transparent=True) for patch in tex.patches: patch_data = read_lump(wad, pnames[patch.patch_index]) place_patch_on_canvas(canvas, patch_data, patch.xoff, patch.yoff) save_png(canvas, f"{tex.name}.png", palette)
6. Exporting maps (levels)
A Doom map is not a single image — it’s a set of structured lumps forming geometry and gameplay data. To export a map for editing, or to create an image (overhead map), follow these steps.
A) Exporting for editors (to a .wad or compatible format)
- If the map is already inside your WAD, editors like GZDoom Builder or SLADE can open and save the map. To export a specific map to a new WAD:
- In SLADE, locate map header lumps (e.g., MAP01 or E1M1).
- Select all lumps between the map header and the next header (THINGS through SECTORS etc.).
- Right-click → Export selection → Save as a new WAD or append to another WAD.
B) Exporting an overhead image of the map
- Use SLADE’s map viewer:
- Open the map header (double-click the MAPxx lump).
- Switch to the map view (2D).
- Adjust zoom, brightness, and color settings.
- Use File → Save map image (choose PNG).
- Alternatively, use a map editor (GZDoom Builder) for higher-quality rendering, lighting, and overlay options.
C) Converting map geometry to other formats (OBJ, SVG)
- For 3D engines or 3D printing, you may want to export geometry to OBJ.
- Tools/scripted projects exist that convert Doom’s linedefs/sectordefs into meshes. The general approach:
- Convert map sectors (polygons) into planar faces.
- Triangulate faces and extrude using floor/ceiling heights.
- Export vertices, faces, and UVs to OBJ.
- Some community tools (search for “Doom to OBJ” converters) automate this; confirm they support your map format (Boom, ZDoom, etc.).
7. Handling palettes and brightness
Original Doom uses a 256-color palette (PLAYPAL). When exporting textures:
- Use PLAYPAL to map indexed pixels to true color.
- Avoid automatic color conversions that dither or remap the palette.
- For modern ports (GZDoom, etc.), consider generating sRGB-correct PNGs and linear-light textures if you will use them in modern engines.
For flats and colormap-dependent graphics (lighting), remember that Doom used colormaps to simulate lighting — the raw texture is the unlit base. Lighting is applied at runtime by palette lookup; if you export textures for modern engines, you may need to bake multiple brightness levels or rely on the engine’s lighting system.
8. Dealing with extended WAD formats and modern ports
Many source ports and PWADs use extended lumps or texture systems (e.g., ZDoom’s TEXTURES lumps or PK3/ZIP containers). Tips:
- PK3 files are just ZIPs with Doom lumps inside; rename to .zip and extract.
- GZDoom and other ports may use decorated lumps or ACS scripts; these don’t affect basic texture extraction but may change how maps behave.
- TEXTUREx and PNAMES variations: some mods include custom texture definitions; always inspect the lumps for nonstandard names.
9. Common issues and troubleshooting
- Missing textures (purple/black or blank areas): usually due to missing patches referenced by PNAMES. Check that the patch lumps exist or that PNAMES is correct.
- Incorrect colors: ensure you applied the correct PLAYPAL. Some WADs include a custom PLAYPAL—use the lump inside the WAD.
- Overlapping patches or seams: use the exact offsets from TEXTURE1/TEXTURE2; reconstruction must honor negative offsets and patch widths.
- Map viewer errors: ensure you export all required lumps (THINGS, LINEDEFS, SIDEDEFS, VERTEXES, SECTORS, NODES, SEGS, SSECTORS, REJECT). Some editing operations require additional lumps (BLOCKMAP, etc.) which can be regenerated by editors.
10. Automation and batch workflows
For large-scale extraction:
- Script the process using Python with a WAD-parsing library (e.g., wadlib, wads or custom parser).
- Batch steps:
- Extract PLAYPAL and PNAMES.
- Iterate TEXTURE lumps and reconstruct textures to PNG.
- Export flats and sprites.
- Save maps or convert them to a chosen format.
- Keep generated assets in a structured folder layout:
- /textures/
- /flats/
- /sprites/
- /maps/
11. Example: quick SLADE workflow summary
- Open WAD in SLADE.
- View PNAMES and TEXTURE1 — inspect textures.
- Select all patch lumps (or folder) → Export → PNG (keep palette).
- Open a MAPxx lumps → Map view → File → Save map image (PNG) or export map lumps to a new WAD.
12. Legal and community considerations
Respect the original game and community content rules. Do not redistribute assets from commercial WADs without permission. Share tools, tutorials, and your own creations, but attribute sources where appropriate.
If you tell me which WAD and which maps or textures you want to extract (and whether you prefer a GUI or scriptable approach), I can give exact commands or a ready-to-run script for automated extraction.
Leave a Reply