ws-3d3-d: model/b3d (Blitz3D read: brushes, textures, node tree, skins, keyframe animation; LH -> RH)
This commit is contained in:
1 parent
de4f14a343
commit
07dc6f7e84
7 files changed
+1106
-1
No files matched your search
@@ -35,6 +35,7 @@ is tested under both runtimes (luau `--codegen -O2` and LuaJIT through the build
|
||||
| video | mpegts | .ts .m2ts .mts .tsv | yes | - | streaming: true, video: "mpeg1", "h264", audio: true | `tests/video/mpegts.luau` |
|
||||
| video | y4m | .y4m | yes | yes | streaming: true, video: "rawvideo", depths: 8, 10, 12, 16 | `tests/video/y4m.luau` |
|
||||
| model | 3mf | .3mf | yes | yes | materials: true, vertexColors: true, textures: true, units: true | `tests/model/3mf.luau` |
|
||||
| model | b3d | .b3d | yes | - | materials: true, textures: true, skins: true, animation: true, colors: true | `tests/model/b3d.luau` |
|
||||
| model | dae | .dae .zae | yes | yes | materials: true, polygons: true, skins: true, morphTargets: true, animation: true, cameras: true, lights: true, zae: true | `tests/model/dae.luau` |
|
||||
| model | fbx | .fbx | yes | yes | binary: true, ascii: true, materials: true, animation: true, skins: true, morphTargets: true, cameras: true, lights: true, polygons: true | `tests/model/fbx.luau` |
|
||||
| model | gltf | .gltf .glb | yes | yes | binary: true, materials: true, animation: true, skins: true, morphTargets: true, cameras: true, lights: true | `tests/model/gltf.luau` |
|
||||
|
||||
+15
-1
@@ -1,6 +1,6 @@
|
||||
# Scene (3D models) and Voxels
|
||||
|
||||
Every model format (glTF / GLB, OBJ, STL, PLY, OFF, FBX, Collada, 3MF, USDA, VOX) loads as one `Scene`, a structure
|
||||
Every model format (glTF / GLB, OBJ, STL, PLY, OFF, FBX, Collada, 3MF, USDA, VOX, B3D, LDraw) loads as one `Scene`, a structure
|
||||
shaped like glTF 2.0: a node tree, meshes made of primitives, flat attribute buffers (accessors), PBR materials,
|
||||
textures, cameras, lights, skins and animations. Mesh-only formats (STL, PLY, OFF) give a one-node scene. MagicaVoxel
|
||||
files also carry voxel grids (`scene.voxels`). Editing goes through `F.ops.mesh`.
|
||||
@@ -378,6 +378,19 @@ local vox = assert(F.save(grid, nil, { format = "vox" })) -- a grid alone saves
|
||||
assert(F.load(vox).voxels[1].size[1] == 4)
|
||||
```
|
||||
|
||||
## Blitz3D (B3D)
|
||||
|
||||
`.b3d` files (Blitz3D, also written by many old game tools) load read-only. The node tree keeps its names and TRS;
|
||||
each `MESH` becomes one mesh whose primitives (one per `TRIS` chunk) share the vertex accessors; brushes become
|
||||
materials (colour, alpha, shininess, the first texture as `baseColorTexture` with its position / scale / rotation as
|
||||
`transform`, the full brush in `extras.b3d`); `BONE` weights become a skin (the 4 strongest weights per vertex) and
|
||||
`KEYS` + `ANIM` one animation sampled at `frame / fps`. Texture files come through `files` / `resolve` like any other
|
||||
model's (by the stored path, then by its base name: B3D files often store absolute Windows paths).
|
||||
|
||||
Blitz3D is **left-handed**: the reader mirrors z (and turns the triangle winding and rotations to match), so the scene
|
||||
is glTF's right-handed Y-up with the model looking as it did in Blitz3D. `meta.source.handedness = "left"` records
|
||||
the origin, `meta.source.fps` / `frames` the `ANIM` chunk.
|
||||
|
||||
## Formats
|
||||
|
||||
| Format | Read | Write | Notes |
|
||||
@@ -392,6 +405,7 @@ assert(F.load(vox).voxels[1].size[1] == 4)
|
||||
| 3MF | yes | yes | |
|
||||
| USDA (+ USDZ read) | yes | yes | |
|
||||
| VOX | yes | yes | voxel grids, scene graph, materials |
|
||||
| B3D (Blitz3D) | yes | | brushes, textures, skins, keyframe animation; left-handed source mirrored to glTF's frame |
|
||||
| STEP | via the CAD plug-in | | see [cad.md](cad.md) |
|
||||
|
||||
Capabilities per format: [FORMATS.md](../FORMATS.md).
|
||||
|
||||
Reference in new issue
Block a user