You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
... to ensure that names in JSX match names GLTFLoader will output, given the same file. However, it's difficult for three.js to guarantee indefinitely that the same .glb file will always result in the same names in future releases. When the file contains duplicate names, GLTFLoader must assign suffixes like _1 or _2, and refactoring or performance changes in GLTFLoader could change the order in which suffixes are assigned.
I'd like to add a step to gltfjsx, pre-processing the input to ensure unique names, so that GLTFLoader's createUniqueName will have nothing to de-duplicate at runtime. That would be an additional step in src/utils/transform.js. Are others OK with this change?
Picking up from pmndrs/react-three-fiber#2498, another issue to consider is that three.js must clone materials when they're reused by incompatible meshes. Presence of vertex colors and vertex tangents would be one example of this. The same prepass could do this change as well, outputting a GLB with N copies of a reused material, each having a unique name.
donmccurdy
changed the title
De-duplicate object names at JSX generation time
Prepass to de-duplicate object names at JSX generation time
Nov 16, 2023
Currently gltfjsx relies on matching the exact implementation of GLTFLoader's
createUniqueName
...https://github.com/pmndrs/gltfjsx/blob/8bf87e1913b941ae16a1c57817d08e865f8568f6/src/bin/GLTFLoader.js#L1911C1-L1924
... to ensure that names in JSX match names GLTFLoader will output, given the same file. However, it's difficult for three.js to guarantee indefinitely that the same .glb file will always result in the same names in future releases. When the file contains duplicate names, GLTFLoader must assign suffixes like
_1
or_2
, and refactoring or performance changes in GLTFLoader could change the order in which suffixes are assigned.I'd like to add a step to gltfjsx, pre-processing the input to ensure unique names, so that GLTFLoader's
createUniqueName
will have nothing to de-duplicate at runtime. That would be an additional step insrc/utils/transform.js
. Are others OK with this change?Related:
The text was updated successfully, but these errors were encountered: