Custom Format Parsers — 6 Previously Broken Imports Now Working

Built 4 custom TypeScript parsers and integrated Three.js loaders to fix WRL, XYZ, TER, IRRMESH, X3D, and M3D format imports that were silently failing.

Six 3D file formats were registered on the platform but silently failing when users tried to convert them. The root cause: the Assimp WASM binding ([email protected]) explicitly disables these importers in its build configuration. We've fixed all six.

What Changed

Instead of waiting for upstream WASM support, we wrote 4 custom TypeScript parsers and integrated 2 Three.js loaders directly into the conversion pipeline:

Three.js Loaders

  • WRL (VRML 97) — Now uses Three.js VRMLLoader for reliable parsing of VRML scene files
  • XYZ (Point Cloud) — Uses Three.js XYZLoader for point cloud data import

Custom TypeScript Parsers

  • TER (Terragen Terrain) — Binary parser that reads heightmap data, generates triangle meshes with computed vertex normals
  • IRRMESH (Irrlicht Mesh) — XML parser that extracts vertex buffers with positions, normals, and indices from Irrlicht's mesh format
  • X3D (Extensible 3D) — XML parser supporting IndexedFaceSet, IndexedTriangleSet, and Box geometry nodes with fan triangulation
  • M3D (Model 3D) — Binary chunk parser with zlib decompression, reading vertex and face data from HEAD/VRTS/MESH chunks

Why Custom Parsers

The assimpjs npm package disables many format importers to keep the WASM binary small. Rather than maintaining a custom Assimp WASM build (complex, fragile), we wrote lightweight TypeScript parsers that:

  • Run in both Web Workers (browser) and Node.js (tests)
  • Have zero external WASM dependencies
  • Are fully covered by unit tests with real model fixtures
  • Total just ~630 lines of code for all four parsers

Technical Details

All six formats feed into the existing threejs-import worker pipeline: custom parser extracts geometry → Three.js BufferGeometry → GLTFExporter → GLB intermediate format → any of 19 output formats.

Every format now has dedicated test coverage using real 3D model fixtures from the Assimp test suite. The full test suite runs 164 tests with 0 failures.