Skip to content
This repository has been archived by the owner on Dec 22, 2023. It is now read-only.

Add samples that use POINTS and LINES and other mesh modes #124

Closed
emackey opened this issue Oct 26, 2017 · 14 comments · Fixed by #387
Closed

Add samples that use POINTS and LINES and other mesh modes #124

emackey opened this issue Oct 26, 2017 · 14 comments · Fixed by #387

Comments

@emackey
Copy link
Member

emackey commented Oct 26, 2017

A glTF mesh can have a number of different modes:

https://github.com/KhronosGroup/glTF/blob/c02fd64e1fc15985d84cbbfacb536709f7c22e28/specification/2.0/schema/mesh.primitive.schema.json#L32-L56

We should have samples that exercise all of these modes. In particular, POINTS and LINES are very different from the other modes, and need their own samples. But all modes should be tested. (Edit: Perhaps not, see below.)

See KhronosGroup/glTF#917 for upcoming spec clarification on lighting of points and lines.

@bghgary
Copy link
Contributor

bghgary commented Oct 26, 2017

The asset generator project will generate unit models with an asset for each primitive mode. See our roadmap here: https://github.com/bghgary/glTF-Asset-Generator/issues/63.

@donmccurdy
Copy link
Contributor

There is also an "Outlined Box" example donated to three.js: https://threejs.org/examples/?q=gltf#webgl_loader_gltf

@andreasplesch
Copy link

see also #106

@bghgary
Copy link
Contributor

bghgary commented Dec 12, 2017

These are basically dupes. Should we merge the threads? We are very close to releasing a version of generated assets that has all of these modes.

@andreasplesch
Copy link

I closed #106 now that the issues are cross-referenced.

@bghgary
Copy link
Contributor

bghgary commented Dec 15, 2017

v0.4 of the generated assets now has all of these modes: https://github.com/bghgary/glTF-Asset-Generator/blob/v0.4.0/Output/Mesh_Indices/README.md

@javagl
Copy link
Contributor

javagl commented Jan 11, 2023

We should probably think about how to align the models from this repo with the models from the asset generator. While the requirement for having models with different modes is covered with the asset generator output, I wonder whether this issue could be closed, or whether we should explicitly add one model here that shows the different rendering modes at once. (I think there should be such a model, as one of the Simple.... test models, and maybe I'll try to allocate some time to create one...)

@donmccurdy
Copy link
Contributor

Note that Blender can export these too, if you dissolve faces and export with the "Loose Edges" and "Loose Points" options. Could be helpful if creating more than primitive shapes.

@javagl
Copy link
Contributor

javagl commented Jan 11, 2023

I considered #329 to eventually cover this issue to some extent (and that sample might have been created with blender...?). But the focus there is on the rendered appearance with PBR, which is different from what would be the goal of a Simple... test model. The latter would really just be a bunch of hexagons, with GL_POINTS, GL_LINES, GL_LINE_LOOP, GL_LINE_STRIP, GL_TRIANGLES, GL_TRIANGLE_STRIP and GL_TRIANGLE_FAN, and some info about the differences in the indexing in the README.md.

@donmccurdy
Copy link
Contributor

Beyond the scope of a sample model here, but just for fun:

The idea is to start with GL_LINES, and do post-processing for the intentionally pixelated effect.

@emackey
Copy link
Member Author

emackey commented Jan 12, 2023

I've recently wondered if GL_TRIANGLE_STRIP and GL_TRIANGLE_FAN are ever used in the wild. Back in the late 90's ~ early 00's, one of my then-coworkers became enamored with triangle strips and I've recently been taking a close look at a large number of old models that came through his converter. Even a relatively simple mesh of a few thousand triangles typically requires dozens or hundreds of separate triangle strips. A "cylinder" primitive in this old format used one triangle strip for the walls and two separate triangle fans as the end caps. These would be separate draw calls, or separate glTF primitives, right? Can a glTF GL_TRIANGLE_STRIP primitive contain more than one strip? That would require Primitive Restart which glTF doesn't offer, right?

In my efforts to upgrade these old models to glTF, I've arrived at the conclusion that undoing all of the triangle strip/fan work and throwing all the triangles into a single primitive seems better. Is there any reason to favor strips/fans?

Certainly this sample repo should have GL_LINES and GL_POINTS (separately I would think, for debugging and conformance testing). I'm not so sure we should be promoting strips and fans.

@donmccurdy
Copy link
Contributor

donmccurdy commented Jan 18, 2023

We (three.js) have already removed support for GL_TRIANGLE_STRIP and GL_TRIANGLE_FAN. glTF files containing those primitives are converted at load time, but in practice I've never seen this feature used.

Related discussion:


Totally defer to maintainers on what an appropriate GL_LINES sample would be, but here's a model I built in Blender a while back. Loosely inspired by ruined temples from the game, Gris. Tested in three.js and Babylon.js.

TempleLines.glb.zip

Screenshot 2023-01-17 at 8 51 56 PM

@michaliskambi
Copy link

I found this thread when looking for glTF test models using lines and points.

@javagl
Copy link
Contributor

javagl commented May 9, 2023

This thread had been open in a tab since my previous comment in January. I finally opened a PR that might close this: #387

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

Successfully merging a pull request may close this issue.

6 participants