-
-
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
GLTFExporter: Support EXT_mesh_gpu_instancing
to export InstancedMesh
.
#26854
GLTFExporter: Support EXT_mesh_gpu_instancing
to export InstancedMesh
.
#26854
Conversation
For testing: https://rawcdn.githack.com/PalashBansal96/three.js/gltf-exporter-gpu-instancing/examples/misc_exporter_gltf.html The import can be tested with the respective editor: https://rawcdn.githack.com/PalashBansal96/three.js/gltf-exporter-gpu-instancing/editor/index.html |
TRANSLATION: writer.processAccessor( new BufferAttribute( translationAttr, 3 ) ), | ||
ROTATION: writer.processAccessor( new BufferAttribute( rotationAttr, 4 ) ), | ||
SCALE: writer.processAccessor( new BufferAttribute( scaleAttr, 3 ) ), | ||
}; |
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.
A comment for potential future optimization. (So no need to do in this PR.)
As commented at
the attributes are optional and we may be able to think of exporting an attribute only if it has non-default value. For example, it may not be too rare that all scales are default (1, 1, 1) and in such a case the exported file size can be reducted.
Another approach would be the exporter always exports all the attributes as this PR does, and the optimization can be done in external gltf post-processing pipeline.
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.
Sounds good, I have tried it here: PalashBansal96@85bac3d
If it looks fine I can push it in this PR.
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.
We can also merge the PR first and then apply the optimization. In this way, the changes presented in this PR are not blocked.
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.
Sure, I can make another PR later.
EXT_mesh_gpu_instancing
to export InstancedMesh
.
Description
Adds support to export InstancedMesh in gltf for both the instanceMatrix and instanceColor. Also, change in GLTFLoader to load the exported instanceColor.
Changed the gltf_exporter example to add a test InstancedMesh in scene1.
This contribution is funded by Threepipe