model/ase: 3ds Max ASCII Scene Export read + write (geometry, Multi/Sub-Object materials, texture channels, colours, normals, NODE_TM hierarchy, helpers, cameras, lights; checked against assimp)

This commit is contained in:
4DBug committed 2026-11-01 18:34:55 -06:00
1 parent 01c044805f
commit 0b6773db8b
12 files changed
+1814 -1

No files matched your search

+24
View File
@@ -716,6 +716,29 @@ assert(back.meta.source.format == "iqm" and back.meshes[1].name == "tri")
assert(back.meshes[1].primitives[1].indices.count == 3)
```
## 3ds Max ASCII export (ASE)
`.ase` files (`*3DSMAX_ASCIIEXPORT`) load as a Z-up scene: one node per geometry, helper, camera and light object,
parented by `*NODE_PARENT`. ASE stores mesh vertices in world space; the reader moves them into the node's frame (the
inverse `*NODE_TM`), so `Scene.flatten` puts them back where 3ds Max had them. Faces split into one primitive per
sub-material of a Multi/Sub-Object material (`*MESH_MTLID`); each corner is its own vertex (texture channels,
vertex colours and `*MESH_VERTEXNORMAL`s are per corner). Materials are Phong (the raw values in `extras`), bitmaps
become textures with a `uri` (data through `opts.resolve`), UVW tiling / offset a texture transform. Camera FOVs
stay the stored horizontal angle. `*TM_ANIMATION` tracks are not read (`meta.source.animated` says they exist).
The writer puts every scene material in one Multi/Sub-Object material and writes world-space vertices.
```luau
local scene = assert(F.load(aseText))
assert(scene.meta.source.format == "ase" and scene.meta.up == "z")
assert(#scene.materials == 2 and scene.materials[1].name == "Brick")
local quad = scene.nodes[2]
assert(quad.name == "Quad" and #scene.meshes[quad.mesh].primitives == 2)
local tex = scene.textures[scene.materials[1].baseColorTexture.texture]
assert(tex.uri == "textures\\brick.png")
local again = assert(F.load(F.save(scene, nil, { format = "ase" })))
assert(#again.meshes[again.nodes[2].mesh].primitives == 2)
```
## Formats
| Format | Read | Write | Notes |
@@ -746,6 +769,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 |
| ASE (3ds Max ASCII) | yes | yes | Multi/Sub-Object materials, texture channels, vertex colours, normals, helpers, cameras, lights; no animation; Z up |
| 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) |