model/proc: Doom 3 / Quake 4 .proc render geometry (models / surfaces to meshes, clockwise-front turned CCW; portals, BSP nodes, shadow models as data)

This commit is contained in:
4DBug committed 2026-11-01 18:40:10 -06:00
1 parent 7d4e0381fe
commit 719abb97c0
12 files changed
+2498 -1081

No files matched your search

+1
View File
@@ -82,6 +82,7 @@ is tested under both runtimes (luau `--codegen -O2` and LuaJIT through the build
| model | off | .off | yes | yes | polygons: true, points: true, colors: true, binary: false | `tests/model/off.luau` |
| model | ply | .ply | yes | yes | ascii: true, binary: true, polygons: true, points: true, colors: true | `tests/model/ply.luau` |
| model | pmx | .pmx .pmd | yes | - | materials: true, skins: true, morphTargets: true, pmd: true | `tests/model/pmx.luau` |
| model | proc | .proc | yes | - | portals: true | `tests/model/proc.luau` |
| model | qb | .qb | yes | yes | voxels: true, truecolor: true | `tests/model/qb.luau` |
| model | rbxm | .rbxm .rbxl | yes | yes | tree: true, compression: "none", "lz4", "zstd" | `tests/model/rbxm.luau` |
| model | rbxmx | .rbxmx .rbxlx | yes | yes | tree: true | `tests/model/rbxmx.luau` |
+18
View File
@@ -527,6 +527,23 @@ assert(data.sectors[1].fields.user_gravity == 0.5)
assert(data.linedefs[4].tag == 7 and data.blocks[1].type == "vavoombox")
```
## Doom 3 / Quake 4 levels
A compiled `.proc` file (dmap's render geometry: `mapProcFile003`, Quake 4's `PROC "4"`) loads as a Scene: each model
(the areas `_area0`, `_area1`, ... and the inline models of entities) is a mesh with a primitive per surface
(positions, normals, texture coordinates, Quake 4 vertex colours as `COLOR_0`) and a child node of the root; the
materials are URIs. id Tech 4 triangles are clockwise-front, so they are turned counter-clockwise. The portals between
areas, the BSP nodes and the shadow models load as data in `meta.proc`.
```luau
local level = assert(F.model.load(procText))
assert(level.meshes[1].name == "_area0" and level.meta.up == "z")
local proc = level.meta.proc
assert(proc.areas == 2 and proc.portals[1].positive == 1 and #proc.portals[1].points == 12)
assert(proc.nodes[1].negative == -1) -- < 0: area -1 - n; > 0: a node (1-based); 0: solid
assert(level.materials[1].name == "textures/base_wall/lfwall1")
```
## Blitz3D (B3D)
`.b3d` files (Blitz3D, also written by many old game tools) load read-only. The node tree keeps its names and TRS;
@@ -766,6 +783,7 @@ assert(back.meshes[1].primitives[1].indices.count == 3)
| STEP | via the CAD plug-in | | see [cad.md](cad.md) |
| MD2, MD3, MDL, MD5, BSP | yes | - | game models and maps: see "Game models" above |
| SMD | yes | yes | Valve studiomdl data |
| Doom 3 / Quake 4 `.proc` | yes | | render geometry per area, portals and BSP nodes as data |
| UDMF (`.udmf`, `TEXTMAP`) | yes | | Doom maps as text: see "Doom maps (UDMF)" above |
| Roblox `.mesh` (robloxmesh) | yes | yes | see [roblox.md](roblox.md) |
| Roblox `.rbxm` / `.rbxl`, `.rbxmx` / `.rbxlx` | as an `RbxTree` | yes | instance trees with typed properties: see [roblox.md](roblox.md) |