name of the MTL file (as specified in the preload list)
map of material names to properties (Kd, d, map_Kd), or null if not found
// 1. preload OBJ + MTL + texture
me.loader.preload([
{ name: "fox", type: "obj", src: "models/fox.obj" },
{ name: "fox", type: "mtl", src: "models/fox.mtl" },
{ name: "colormap", type: "image", src: "models/colormap.png" },
], () => {
// 2. create a Mesh with material — texture, tint, opacity auto-applied
const mesh = new me.Mesh(400, 300, {
model: "fox",
material: "fox",
texture: "colormap",
width: 200,
height: 200,
});
// 3. or access the raw material data directly
const materials = me.loader.getMTL("fox");
// materials["colormap"].Kd — [r, g, b] diffuse color (0-1 range)
// materials["colormap"].d — opacity (0-1)
// materials["colormap"].map_Kd — resolved texture URL
});
return the specified MTL material data