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

GLTF Blender exporting Quads #1655

Closed
jclarkk opened this issue Aug 6, 2019 · 8 comments
Closed

GLTF Blender exporting Quads #1655

jclarkk opened this issue Aug 6, 2019 · 8 comments

Comments

@jclarkk
Copy link

jclarkk commented Aug 6, 2019

Seems like no matter what we do we're not able to export the mesh as Quads in GLTF.
Even though we have the mesh as Quads in Blender the export seems to convert them into Triangles.

When exporting the same mesh as OBJ it is still represented as Quads.

Is there a reason behind this?

Thanks!

@donmccurdy
Copy link
Contributor

From the Blender addon docs

glTF’s internal structure mimics the memory buffers commonly used by graphics chips when rendering in real-time, such that assets can be delivered to desktop, web, or mobile clients and be promptly displayed with minimal processing. As a result, quads and n-gons are automatically converted to triangles when exporting to glTF.

Support for quads has been proposed, but is currently only a proposal, and would be considerably slower for runtime use, which is the focus of glTF.

@donmccurdy
Copy link
Contributor

There's a separate repository for the Blender exporter: https://github.com/KhronosGroup/glTF-Blender-IO. However, the glTF spec itself intentionally doesn't allow quads, so it's not just a matter of patching the exporter.

@lexaknyazev
Copy link
Member

Support for quads has been proposed, but is currently only a proposal, and would be considerably slower for runtime use, which is the focus of glTF.

That proposal has no runtime cost if an implementation just renders the triangles.

@donmccurdy
Copy link
Contributor

Good point! That particular proposal is clever about it; I should have read through.

@zellski
Copy link
Contributor

zellski commented Aug 6, 2019

Nonetheless, it is probably true that if @jclarkk assumes quad support, he probably also assumes de-facto support for it in the existing glTF ecosystem, and obviously there isn't any.

@ranbuch
Copy link

ranbuch commented Aug 7, 2019

it is probably true that if @jclarkk assumes quad support, he probably also assumes de-facto support for it in the existing glTF ecosystem

Actually, a good reason to export in quads is the .bin (geometry) file size. Although WebGL doesn't support quads it can display it (as triangles, just is it's doing with other formats) and if there's no runtime cost it's a clear winner regarding loading time.

If an artists creates a model in quads, saving it in tris will resolve in twice the geometry size.

@lexaknyazev
Copy link
Member

If an artists creates a model in quads, saving it in tris will resolve in twice the geometry size.

That's not necessarily the case. Vertex attributes (that use most of geometry space) will take the same size regardless of connectivity information. Index buffer that contains only quads could be smaller than the index buffer with triangles, but it would require runtime processing to be rendered with GPU APIs.

The extension proposed by @zellski encodes quads (or other n-gons) by using very specific order of triangles. This allows zero-processing rendering while preserving original connectivity information for tools that need it.

@donmccurdy
Copy link
Contributor

Let's continue discussion in #1620.

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

No branches or pull requests

5 participants