GLTFLoader: Support InstancedMesh / 'EXT_mesh_gpu_instancing'
See original GitHub issueIt would be nice if GLTFLoader
automatically created InstancedMeshes
from a GLTF file including instanced meshes.
Here is an exemple file : instanced_cube.glb
Blender lets us reuse a mesh ( like other modeling softwares I’m sure ), here is the hierarchy in Blender :
I would like GLTFLoader
to (optionaly?) create an InstancedMesh
of this cube, instead of making several identical Meshes
, because :
- Manually removing the created
Meshes
to replace them with anInstancedMesh
is tedious. - It takes memory for nothing. ( potentially a lot )
Some context :
A GLTF file can reuse meshes, this is what the GLTFLoader.parse
get after reading the file above :
Issue Analytics
- State:
- Created 2 years ago
- Comments:11 (3 by maintainers)
Top Results From Across the Web
GLTFExporter support for EXT_mesh_gpu_instancing
Hi team, Can/will EXT_mesh_gpu_instancing extension be supported for GLTFExporter? It appears already supported by GLTFLoader Also appears ...
Read more >InstancedMesh from GLTF doesn't work?! - three.js forum
Hi, InstancedMesh ([1] in code) doesn't work when geometry loaded from GLTF - is ... import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader.js"; ...
Read more >InstancedMesh - glTF-Transform - Don McCurdy
Sets an instance attribute to an Accessor. All attributes must have the same instance count. Defined in packages/extensions/src/ext-mesh-gpu-instancing/ ...
Read more >Tweets with replies by takahiro(John Smith ... - Twitter
the glTF loader plugin hardcodes to load _COLOR attribute as instance color ... attribute · Issue #7 · takahirox/glTF-Blender-IO-EXT-mesh-gpu-instancing.
Read more >How do I get the THREE.JS InstancedMesh working?
JS InstancedMesh to make copies of an imported gltf file, but nothing shows up in the ... const loader = new GLTFLoader() loader.load(...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sorry for slow progress because I have been a bit too busy…
Recently I have fixed some improtant problems in the plugin which I really wanted to resolve before moving it into GLTFLoader.
There is still lack of some supports, SkinnedMesh and better custom instance attributes handling, but they are advanced features. We may be able to start to consider to move the plugin into GLTFLoader as built-in plugin and can think of advanced feature supports later.
If it sounds good, I want to make a PR hopefully soon.
Some additional notes…
I already released the
EXT_mesh_gpu_instancing
glTF loader plugin athttps://github.com/takahirox/three-gltf-extensions/tree/main/loaders/EXT_mesh_gpu_instancing
You can use it now, but note that I didn’t test well yet. Some glTF or Three.js functions might not work (e.g. animation). Once I confirm the functionalities I would think of moving it into the Three.js glTF loader as built-in plugin.
As @donmccurdy explained, our work requires pre-processing. I don’t think of automatically converting the regular meshes to instanced mesh. If you still want to automatically do that, you may write your own plugin with the plugin API (Three.js glTF loader extensibility mechanism). We haven’t written the plugin API document yet, so please refer to the plugins in
https://github.com/takahirox/three-gltf-extensions/tree/main/loaders/
and the built-in plugins in the glTF loader for the API.