This is an experimental render pass for terrains in Amethyst using Cardinal Neighbor Quadtrees and tesselation for Level-of-Detail.
A terrain heightmap is split based on the distance to the viewer using Cardinal Neighbor Quadtrees. Each leaf is tesselated in regards to its neighbor to avoid T-Junctions.
After that, a basic quad mesh is drawn using instanced attributes for each leaf.
Tries to have comparable performance to major engine solutions. The first step is Unreal and Unity final step would be FarCry5's engine e.g.
Some specific targets are:
- Asset streaming and thus splitting of the terrain assets (heightmap, etc.) into tiles for each leaf
- Decals
- Support in amethyst-atelier and the editor
- Fallback for lower spec systems without tesselation support
This approach uses tesselation and geometry shaders and thus does currently not support Metal or older OpenGL versions
- A cnquadtree crate implementing the algorithm from Safwan W. Qasem and Ameur A.
- The render pass for Amethyst in the crate amethyst_terrain
- A simple demonstration crate implementing a game with a simple terrain created with Gaea
This approach was inspired by
- https://github.com/drecuk/QuadtreeTerrain/blob/master/30.SYS-QuadtreeTerrain/TerrainQuadTree.cpp
- https://bitbucket.org/victorbush/ufl.cap5705.terrain/src/93c5ab3824a5a66d87d1bb6dcc9ed9aee7a16357/src_non_uniform/shader/?at=master
- https://developer.nvidia.com/gpugems/GPUGems2/gpugems2_chapter07.html
- and the FarCry5 GDC Slides.