Skip to content

feat(terrain): add fixed grid terrain tesselator#3404

Closed
charlieforward9 wants to merge 3 commits into
masterfrom
cr/terrain-grid-tesselator
Closed

feat(terrain): add fixed grid terrain tesselator#3404
charlieforward9 wants to merge 3 commits into
masterfrom
cr/terrain-grid-tesselator

Conversation

@charlieforward9
Copy link
Copy Markdown
Collaborator

@charlieforward9 charlieforward9 commented Apr 23, 2026

Goals

  • add a FAST fixed-grid terrain mesh option to @loaders.gl/terrain
  • give deck.gl TerrainLayer a loader path that emits stable longitude/latitude/elevation meshes
  • keep existing Martini and Delatin behavior unchanged

Changes

  • add terrain.tesselator = 'grid' with configurable terrain.gridSize
  • add buildGridMeshAttributes and makeGridTerrainMesh
  • generate fixed-resolution indexed triangle grids with bilinear height sampling
  • sample rows uniformly in Mercator-y to avoid high-latitude warping from latitude-uniform sampling
  • support optional skirts on edge vertices without skewing the terrain bounding box
  • export the new grid terrain helpers and types from @loaders.gl/terrain
  • wire the grid path into TerrainLoader and makeTerrainMeshFromImage
  • add shared terrain tests covering grid mesh size, lng/lat output, Mercator-y midpoint sampling, and skirt behavior
  • add docs-ready API examples for both TerrainLoader grid usage and direct makeGridTerrainMesh() usage

Validation

  • yarn lint fix
  • yarn build
  • yarn test-node modules/terrain/test/terrain-loader.spec.js
  • yarn test-headless modules/terrain/test/terrain-loader.spec.js

Notes

  • this PR intentionally does not add a standalone website/gallery demo
  • the fixed grid path is aimed at FAST predictable tile density and longitude/latitude output positions for downstream renderers such as deck.gl TerrainLayer

@ibgreen-openai
Copy link
Copy Markdown
Collaborator

Is he goal mainly a faster tesselator?
Can we add some benchmarks (yarn test bench, yarn test bench-headless) to verify that it is worth the additional code?

@charlieforward9
Copy link
Copy Markdown
Collaborator Author

charlieforward9 commented Apr 23, 2026

@ibgreen-openai It's not only speed, there is a warping problem in the texture that this seems to fix as well.

See visgl/deck.gl#10250 (comment)

Adding benchmarks now

@charlieforward9
Copy link
Copy Markdown
Collaborator Author

image @ibgreen-openai i think its fast

@charlieforward9 charlieforward9 marked this pull request as ready for review April 23, 2026 16:51
@charlieforward9 charlieforward9 self-assigned this Apr 24, 2026
@charlieforward9
Copy link
Copy Markdown
Collaborator Author

charlieforward9 commented Apr 28, 2026

I am exploring the martini tesselator after your feedback in more detail since it does a MUCH better job of smoothing the terrain mesh out. I will continue to explore this over the coming days and decide whether this addition code path is worth it for the speed.

@charlieforward9 charlieforward9 marked this pull request as draft April 28, 2026 14:51
@ibgreen-openai
Copy link
Copy Markdown
Collaborator

Good idea.
I was thinking it could be good to add the size of the meshes generated to the table as well. To get a good approach with your fast mode you probably need a much finer grid which will affect memory use / rendering speed etc.
Maybe ask Codex to do an optimization pass on the existing tesselators, see if anything can be gained?

@charlieforward9
Copy link
Copy Markdown
Collaborator Author

charlieforward9 commented May 13, 2026

there is a warping problem in the texture that this seems to fix as well

visgl/deck.gl#10293 fixes this

visgl/deck.gl#10294 Follows up on experiments to improve TerrainLayer loading

Closing one as I take a more responsive LoD refinementStrategy and globe cache approach for improving GlobeView initialization and flyToTransition UX

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants