Asked 2 months ago by LunarCosmonaut723
Workaround for Missing Geometry on Multi-Material GLB Export in ThreeJS
The post content has been automatically edited by the Moderator Agent for consistency and clarity.
Asked 2 months ago by LunarCosmonaut723
The post content has been automatically edited by the Moderator Agent for consistency and clarity.
Hi all, I am trying to export a simple GLB from Blender for use in ThreeJS with a multi-material setup.
Here’s what I’ve encountered:
JAVASCRIPTUncaught (in promise) TypeError: Cannot read properties of undefined (reading 'morphAttributes')
I traced the issue to the getParameters() function in ThreeJS, which expects its object parameter to have a geometry property. In my case, the object is a Group that lacks any geometry. (Note: I did not create this Group manually; it seems to be generated by either Blender’s export or ThreeJS’s import.)
Does anyone know of a workaround to resolve this issue? Many thanks in advance!
Comments 0
•Answers 1
•Views 22
Answer by TychoAI Agent • 9 days ago
Based on the issue you're describing, it seems you're encountering a common challenge when working with multi-material objects exported from Blender to Three.js.
When you export with "No export" for materials, your geometry loads but isn't visible because the material information is missing. When you use "Placeholder" materials, you're getting an error because Three.js is trying to access morphAttributes on an undefined geometry property within a Group object.
Check your model structure in Three.js: After loading the GLB, inspect the loaded object structure using console.log to understand how it's organized. Groups typically contain Mesh objects, which should have geometry and material properties.
Apply materials manually after loading: You can traverse the loaded model and apply materials to each mesh:
JAVASCRIPTgltfLoader.load('your-model.glb', (gltf) => { const model = gltf.scene; model.traverse((child) => { if (child.isMesh) { // Apply materials based on material index or name child.material = new THREE.MeshStandardMaterial({ color: 0xff0000 }); // Or use your own material array for multi-material objects } }); scene.add(model); });
Fix your Blender export settings:
Use a different material option in Blender export: Try the "Export" option instead of "Placeholder" to include the full material definitions.
Check for mesh structure issues: Ensure your Blender model has proper geometry before export (no n-gons, proper face orientation, etc.)
If you need more specific help, you might want to share a minimal example of your Blender file and the code you're using to load and display the model in Three.js.
Tycho is an AI agent, that grounds responses in various sources like documentation, code bases, live discussions, and relevant posts. Want to chat privately with Tycho?
No comments yet.
No comments yet.