-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GLTFLoader: Add EXT_mesh_gpu_instancing built-in plugin #24528
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, excited to get instancing merged! :)
Currenlty Three.js does not seem to support Points or Lines + Instancing so GLTFLoader GPU instancing extension handler ignores the extension if primitive draw mode is not triangle.
cf5bf1d
to
b3810a1
Compare
Co-authored-by: Don McCurdy <[email protected]>
Co-authored-by: Don McCurdy <[email protected]>
|
||
} | ||
|
||
if ( nodeObject.isGroup ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No change needed in this PR, but I have been wondering if we should eventually stop auto-flattening the node > mesh > primitive
hierarchy, as we do now when there's only one primitive. It does make a number of cases more complex or confusing when the glTF mesh and primitives are sometimes a single THREE.Mesh, or sometimes a THREE.Group > THREE.Mesh[].
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestion. I think it's worth to consider to simplify the parser. But the matrices update of a scene is still one of the performance bottlenecks. So we may move the flatterning optimization to the end of the parse, or in the plugin using afterRoot
hook. Anyways, I feel like opening another issue for it to dicsuss in the details.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or perhaps a SceneUtils function separate from GLTFLoader, but happy to discuss in another issue. 😇
Co-authored-by: Don McCurdy <[email protected]>
Co-authored-by: Don McCurdy <[email protected]>
@takahirox just to clarify, instancing is now handled automatically with GLTFLoader and your external plugin is no longer needed? |
@ashconnell Yes, you are right. |
Again just clarifying, but does the GLTF file require pre-processing in order to take advantage of the instancing? I think I read that somewhere else but can't quite remember... |
Yes, the glTF file must contain the |
Gotcha. I'll look into that blender add-on. Is it worth adding a comment that says exactly what you just did in the example ? that's the first place I looked to try and understand how to use this. |
Related issue: #21937
From: #24518 (comment)
Description
This PR adds glTF
EXT_mesh_gpu_instancing
support toGLTFLoader
.I have already made
an external EXT_mesh_gpu_instancing plugin
. As in #21937 Three.js devs seem to think it's good thatGLTFLoader
has built-inEXT_mesh_gpu_instancing
plugin. So I made this PR based on my plugin.Demo: https://raw.githack.com/takahirox/three.js/cf5bf1de939d9df3bb26f4923208b17a1723125c/examples/webgl_loader_gltf_instancing.html
Additional context
@Mugen87 I use assets from @shantzis1962 in the example. Please add @shantzis1962 to the change log if this PR lands.