How to export a Gltf as Quad data?

I know that the three.js does not support quads, however, I am wondering how the GLTFExporter can be modified to support exporting everything as quads.

Can I simply supply the gltfexporter with buffergeometry that uses position attributes with itemSize of 4 instead of 3? and with the corresponding indexes?

Neither three.js nor glTF support quads, sorry. glTF is made for delivering 3D models to runtime viewers, which often cannot render quads directly on the GPU without first triangulating them, so the format always uses triangles, points, or lines currently.

It might be possible to export quads with a more offline-focused format like OBJ, COLLADA, or FBX, although I’m not sure if the three.js exporters for those formats support it.

1 Like

thanks for the info! I was already planning to create my own obj exporter since that format is relatively simple… Just had thought maybe the gltf would have supported it.

Just curious, has this changed at all in 2025? I use Nomad sculpt a lot which can import and export quads/ngons via glb. I’m also using a new rigging and animation app called Morphin which is built on threejs, it would be great if that could do the same tricks Nomad does to avoid triangulation.

Quads are problematic because there is no constraint on them being planar, and there isn’t a standard on which 2 vertices the quad should break (into triangles)…
so maybe you get this:

-----
\    |
  \  |
    \|
___

or maybe you get this:

-----
    /|
  /  |
/    |
___

I know quads can be preferable for modelling and content generation, especially because wireframe quads are more pleasing to look at… but for rendering, they introduce a lot of complexity with next to zero benefit.

I would hazard a guess that the import/export from nomad actually inspects the triangles and merges them back into quads/ngons where appropriate.

1 Like

[Edit:] fixed the referenced jsfiddle

Agreed.

I beg to differ:

A few years ago, we had a discussion here about the

See this for a reminder:


I understand some of the reasons, why support for quad rendering has been removed from Three.js. But there are cases where mapping quality (and by extension: quality of reflections) would greatly benefit from rendering quads.

I’d be a bit surprised if even Nomad is actually rendering quads. Certainly they’re managing quads in the working scene representation, and arranging vertex data by face, that’s very helpful… but I expect everything is still being triangulated for rendering.

The case you show was never supported in the first place though. Sure you could specify a quad polygon, but the mapping would still be the same as your screenshot. Even blender arbitrarily picks a pair of split vertices for a quad, so the distortion is still ill defined.
This is more just the fundamental nature of texture mapping, no?

(I am having some deja vu here though, so its entirely possible we discussed this before and came to a different conclusion…)

It can be done. WebGL instead of Three.js.
Note: the author is drawing GL_TRIANGLES, not GL_QUADS (line 165):

jsfiddle

What did you intend to show with that fiddle (it’s also using triangles) ?

The comments in this thread go over some of the thing i’m trying to articulate here:

and here:

https://www.gamedev.net/forums/topic/597375-quads-or-triangles-in-gldrawelements/

Here’s one from 14 years ago… look at the “jurassic vertices” section :smiley: :

Full disclaimer, I’m a houdini artist in my day job, pretend to read code, but its not my thing, so take all I say with a grain of salt or two. :slight_smile:

@manthrax , re the points you raise re being planar or the diagonal being added one way or the other, I think that’s an accepted known issue in all 3d apps; if your quads aren’t small enough and planar enough that you end up seeing odd trangulation issues, or triangles start to flip orientation as the mesh animates, well, thats on the artist to identify and correct. the pros in terms of easier to understand rigging, weight painting, uv’s, edge selection etc, outweigh the cons.

@donmccurdy he’s definitely rendering triangles, you can turn off smooth shading and see the mesh in all its triangly glory, but as long as saving/loading returns the quads as i left them, and you either make the quads small enough that you don’t see the triangles, and/or turn on smooth shading, its not really an issue for the end user.

The specific issue in morphin is painting weights; having quads makes it much easier to see what you’re doing, get less distracted:

vs triangles, where the edge layout can often fight against you and make it hard to see what you’re doing:

There’s also the question of being able to cleanly apply subdivision to a mesh, without quads this can create all sorts of pimples and shading artifacts. Morphin doesn’t do this, but if it does, or if we could send the animated meshes out to something like the amazing threejs pathtracer, being able to subdivide cleanly would be great.

Regardless, you’ve all answered the question that its not supported in threejs atm, thanks for all the replies and extra info!

1 Like

I missed this earlier, its exactly what Nomad does. :slight_smile:

There’s a full thread on it here, my understanding is it was suggested as an extension to gltf, stalled for various reasons, but Nomad implemented it anyway: FB_ngon_encoding extension. by zellski · Pull Request #1620 · KhronosGroup/glTF · GitHub