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

Exporting/Importing causing edge split and duplicate materials. #590

Closed
xeper8x8 opened this issue Jul 13, 2019 · 5 comments
Closed

Exporting/Importing causing edge split and duplicate materials. #590

xeper8x8 opened this issue Jul 13, 2019 · 5 comments
Labels
exporter This involves or affects the export process Mesh_&_Object

Comments

@xeper8x8
Copy link

xeper8x8 commented Jul 13, 2019

Describe the bug
When importing my objects, they are double the vertex/face/edge/ count. It seems like the object was edge split, when in fact edge split was never even used right exactly before exporting. I did use edge split while making the model but only in certain areas. Not sure if its the exporter doing this or importer since there is no options for edge splitting the object for either import nor export. Additionally, its duplicating the materials.

To Reproduce
Steps to reproduce the behavior:

  1. Open issue.blend. (I uploaded .blend file before export happens so its normal with 184,612 vertex count and only 3 materials)
  2. Go to Export. Export as .glb to desktop or where ever else
  3. Delete original object and then Import object (as .glb). Once imported you will then notice the vertex count as 251,927 and the 3 extra Material.000's.
  4. Select object and press TAB to vertex mode.
  5. Select/click any object or vertices and you will notice the double vertex/face/edge.

Expected behavior
I expected the object not to be double in vertex/face count and not have any material duplicated. Unless edge splitting and material duplicating is how .glb functions?

.blend file/ .gltf
https://www.dropbox.com/s/goy24fw9qf4colu/issue.blend?dl=0

Version

  • OS: Windows 7
  • Blender Version 2.80

Additional context
I did edge split some areas of the model, but only certain areas like the shoes. The arms torso, legs, i never used edge split and theyre edge split after importing. This has been happening to every single object i import/export, so its not just the object in the .blend file.

@emackey
Copy link
Member

emackey commented Jul 15, 2019

glTF is a GPU-friendly format. Vertices with discontinuous UVs, discontinuous normals etc. must be split during export. Each vertex has a set of associated attributes in memory, there's no concept of a "shared" vertex that has separate attributes per face.

@julienduroure julienduroure added exporter This involves or affects the export process Mesh_&_Object labels Jul 25, 2019
@colinfizgig
Copy link

This creates extra vertices in WebGL apps like AframeVR or three.js and causes issues with models when they are reimported into blender. You can merge the verts by distance but this creates numerous issues with the models faces and normals. Is there a fix to this? It's very problematic for WebGL uses which is a main function of GLTF as a file format.

@emackey
Copy link
Member

emackey commented Nov 25, 2019

It's very problematic for WebGL uses

It's built for WebGL. WebGL can't handle per-face discontinuous UVs. You're required to split the verts. Desktop GPUs need that too, Blender is just hiding that effect from the artist. A single Blender vertex can represent many co-located GPU vertices.

@scurest
Copy link
Contributor

scurest commented Jul 20, 2020

Note that the .blend has normals/UVs/colors turned off. So (at least now that #1023 is merged) verts are not split because of discontinuities in those.

The reason is verts get split when they're in tris with different materials. This is not required by glTF though. If you have two tris with different materials, they get exported like this.

pic1

However it could also do it like this, with a shared accessor

pic2

It wouldn't help the importer any though; it always imports primitives separately.

@julienduroure
Copy link
Collaborator

Closing, as we now have an option to export shared accessors, helping not splitting for material difference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exporter This involves or affects the export process Mesh_&_Object
Projects
None yet
Development

No branches or pull requests

5 participants