-
-
Notifications
You must be signed in to change notification settings - Fork 663
3D Loading and Supported Assets
Part of Working in 3D.
3D geometry loads through the standard asset pipeline (me.loader), the same as images, audio, or Tiled maps. Two formats are supported:
| Format | Asset type
|
Best for |
|---|---|---|
| Wavefront OBJ/MTL |
"obj" + "mtl"
|
a single static model (prop, character billboard) |
| glTF 2.0 / GLB |
"gltf" / "glb"
|
a whole authored scene — node hierarchy, multiple meshes, a camera (see Loading glTF / GLB scenes) |
WebGL required. 3D meshes render only under the WebGL renderer (
renderer: video.WEBGL). The Canvas2D renderer has no mesh path.
me.loader.preload([
{ name: "fox", type: "obj", src: "models/fox.obj" },
{ name: "fox", type: "mtl", src: "models/fox.mtl" },
{ name: "foxtex", type: "image", src: "models/fox.png" },
], () => {
const mesh = new me.Mesh(400, 300, {
model: "fox", material: "fox", texture: "foxtex",
width: 200, height: 200,
});
me.game.world.addChild(mesh);
});me.loader.getOBJ(name) / getMTL(name) return the raw parsed data if you need it directly. Multi-material OBJ files (multiple usemtl groups) are supported — each group's diffuse color is baked into a per-vertex color buffer, so multiple materials don't cost extra draw calls.
For importing a full scene (many meshes + hierarchy + camera) rather than a single model, see Loading glTF / GLB scenes.
The following applies to all 3D meshes regardless of source format.
| Supported | Not yet |
|---|---|
Positions, UVs (TEXCOORD_0), indexed triangles |
Multiple UV sets, tangents |
| Normals (parsed) | Sparse accessors, Draco compression |
Node hierarchy + per-node TRS (glTF) → Matrix3d
|
Vertex colors from the file |
Multi-material submeshes (OBJ usemtl groups) |
| Supported | Not yet |
|---|---|
| One diffuse / baseColor texture per material | Metallic-roughness, normal, emissive, occlusion (AO) maps |
Diffuse color (Kd / baseColorFactor) as tint |
Full PBR shading |
Opacity (d / baseColorFactor.a) |
Alpha cutoff / per-material blend modes |
| Per-vertex tint multiply (WebGL) | Two-color ("dark") tint on Canvas (WebGL-only) |
| Supported | Not yet |
|---|---|
Transform animation you drive yourself (mesh.rotate() / translate(), tweens) |
glTF animation channels (keyframed TRS) |
| Skeletal animation / skinning — rigged characters import at rest pose (strip the armature before export) | |
| Morph targets (blend shapes) |
For 2D skeletal animation, use the Spine plugin instead.
None for 3D meshes. Meshes render unlit — final color is texture × tint, with no surface shading. Normals are parsed but not yet used for lighting, and Light2d is 2D-only. Flat-shaded / vertex-baked art (e.g. Kenney kits) looks correct; assets that rely on real-time lighting or normal maps will look flatter than in the authoring tool.