-1

When I export the default UV Sphere as GLTF model, it ends up having 1940 vertices. When I export the same model as OBJ, it has 482 vertices (the correct count).

Something not right with the blender GLTF exporter (version 2.83).

user2566142
  • 77
  • 1
  • 4
  • Welcome to Stack Overflow. Please take the [tour] to learn how Stack Overflow works and read [ask] on how to improve the quality of your question. Then check the [help/on-topic] to see what questions you can ask. – Progman Aug 19 '20 at 20:46
  • glTF stores data in a GPU-friendly format, not artist-friendly, so vertex count may increase. See my answer here: https://stackoverflow.com/a/63285168/836708 – emackey Aug 19 '20 at 20:54
  • I guess to convert into artist friendly format, I need to figure out which vertex is which using index data of triangles? Sort of reversing the process of unrolling the array? Or is it even possible?... since that information could be gone. – user2566142 Aug 20 '20 at 02:19

1 Answers1

1

Unlike OBJ, glTF is a runtime format — designed for rendering on a GPU without much processing. Conversion of Blender's vertices to GPU vertices is complicated, and not necessarily 1:1.

If you triangulate the mesh before export and disable most vertex-level data (UVs, Normals, Vertex Colors) in export settings, you have a better chance of having the same vertex count before/after:

screenshot of export settings with UVs, normals, and vertex colors disabled

With those settings, the UV Sphere will have the same vertex count (482) before and after export. With other settings, or other models, there's just going to be a chance your vertex counts will come out differently. That's not necessarily a bad thing — it avoids making the realtime viewers do this work later — but of course there may be cases where you want to bring the vertex count down. If you have general questions about this topic I would suggest starting a thread somewhere like https://blenderartists.org/.

Don McCurdy
  • 10,975
  • 2
  • 37
  • 75