Skip to content
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 duplicates mesh vertices (from 6k to 2millions) #28133

Closed
aymen157 opened this issue Apr 14, 2024 · 3 comments
Closed

GLTFExporter duplicates mesh vertices (from 6k to 2millions) #28133

aymen157 opened this issue Apr 14, 2024 · 3 comments
Milestone

Comments

@aymen157
Copy link

aymen157 commented Apr 14, 2024

Description

Here is the fulll description. at first i thought it was a blender bug. but it seems to be a three js
https://projects.blender.org/blender/blender/issues/120621

both the input and the output models are there.

Reproduction steps

Convert from FBX to GLTF using THREE.GLTFExporter
(the example project is in the zip file, just drop an fbx and do ctrl+enter, you will see the verts exported are duplicated/high count)

Code

Live example

FbxToGLTF_threejs.zip

Screenshots

Screenshots can be seen in the blender issue.

Version

140

Device

Desktop

Browser

Chrome

OS

Windows

@mjurczyk
Copy link
Contributor

Importers create non-indexed geometries, you can "re-index" them with BufferGeometryUtils.mergeVertices.

@aymen157
Copy link
Author

Yes that solves it. Weird though how GLTFExporter doesn't do that automatically?

@donmccurdy
Copy link
Collaborator

donmccurdy commented Apr 14, 2024

The “usual” answer to this question is that DCC tools like Blender represent vertex data differently than 3D engines. With or without an index — many three.js loaders do create indexed geometry — that difference remains. See Vertex Count Higher in Engine Than in 3D Software for more on that.

However ... I think there's something else unexpected going on here. The file contains a lot of vertex arrays that are reused by multiple mesh primitives, so I think perhaps GLTFExporter was failing to reuse vertex arrays correctly. If I export to .glb from the latest three.js editor, the vertex count is just 33K, matching what is loaded into three.js, and within the expected range given the differences mentioned above. So this appears to have been fixed since r140. Possibly by #27268.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants