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

Vertex winding order #11

Closed
davenquinn opened this issue Apr 27, 2020 · 3 comments
Closed

Vertex winding order #11

davenquinn opened this issue Apr 27, 2020 · 3 comments
Labels
question Further information is requested

Comments

@davenquinn
Copy link

I'm working on a prototype module that uses this library + Mapbox elevation tiles to render QuantizedMeshTerrainData tiles in Cesium.

I've managed to get a version working that creates a mesh in Cesium, but all of the tiles are (rather hilariously) warped.

image

I think the issue relates to some combination of the winding order of triangles and the sorting of vertices. Cesium apparently expects triangles wound in counterclockwise order; there may be some restrictions on the sorting of vertices as well (see e.g. this example dataset). I've tried several combinations of rewinding triangles and sorting vertices to no avail.

This may be a better issue to raise in the Cesium context, but I thought I would start here: are there any guarantees on winding order given by this library? Does the pattern of artifacts in my image above look diagnostic of any particular failure mode? Perhaps a few words in the documentation about how the output mesh is structured would allay my confusion.

@mourner
Copy link
Member

mourner commented Apr 27, 2020

This seems like it could be the same issue as #5 (comment) — can you check?

@mourner mourner added the question Further information is requested label Apr 27, 2020
@davenquinn
Copy link
Author

davenquinn commented Apr 27, 2020

Hey @mourner,

It works now! Thanks for looking at this and resetting my brain. I had already looked at #5 and dismissed (I was already extracting heightfield values). But reviewing it again at your behest, I found an off-by-one indexing error in my code. 🤦

image

I'll be working on some of the low-hanging performance and optimization fruit, and bundling into a module, but we can now represent global terrain in Cesium using only streaming Mapbox data! Thanks for laying the groundwork for this advance.

@davenquinn
Copy link
Author

Fixed in davenquinn/cesium-martini@4e81141

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants