-
Notifications
You must be signed in to change notification settings - Fork 7
Meshing methods
CTOD supports a few methods to create a mesh based on the retrieved COG data. According to the quantized mesh spec the quantized mesh need to contain shared edge vertices. To solve this every requested terrain tile also needs the data from it's neighbours, with the neighbour data we are also able to recalculate height and normals on the edges to stitch the tiles together and don't end up with seams between the tiles.
The grid method uses a regular grid to sample the height and triangulate between the picked vertices on the grid. The grid size is configurable trough url parameters and can be set to a default, per zoom or a combination of the two.
Higher grid sizes result in a more detailed mesh but the returned .terrain tile will be larger in file size and can impact the rendering performance in Cesium.
The grid method performs the fastest but is less precise since this method only samples the height from the COG at regular spots.
When requesting a tile the following parameters can be passed to configure the grid meshing.
defaultGridSize
The default grid size to use when a zoom level is not defined inzoomGridSizes
. For example a value of 10 means: 10 cols x 10 rows. This value is set with a default of 10.
zoomGridSizes
The grid size defined per level, when a level is not defined fallback to defaultGridSize
. This is a dictionary with zoom level and the grid size. {"15": 10, "16": 15, ....}
defaultGridSize
is set to 20 in the example, when a zoom level is not present in the zoomGridSizes
it will use the default value of 20.
http://localhost:5000/tiles/17/134972/21614.terrain?cog=MyCog&meshingMethod=grid&defaultGridSize=20&zoomGridSizes={"15": 10, "16": 10, "17": 15, "18": 35, "19": 35, "20": 35, "21": 35, "22": 35}
The Martini method uses RTIN terrain mesh generation and is done with pymartini A mesh is created based on a max error which can be configured trough url parameters like the grid. The lower the error the more detail will be present in the .terrain tile.
Martini is much slower than the grid method but can result in smaller file sizes for the .terrain tiles because vertices/triangles are left out when there is not much height difference (based on max error)
When using a DSM dataset martini might not be the best solution, due to the high changes in height caused by trees and houses it's hard to configure the max error for a good result between terrain and the rest.
When requesting a tile the following parameters can be passed to configure martini meshing.
defaultMaxError
The default max error to use when a zoom level is not defined inzoomMaxErrors
. max error as explained by pymartini: The maximum vertical error for each triangle in the output mesh. For example if the units of the input heightmap is meters, using max_error=5 would mean that the mesh is continually refined until every triangle approximates the surface of the heightmap within 5 meters. This value is set to 3 by default.
zoomMaxErrors
The max error defined per level, when a level is not defined fallback to defaultMaxError
. This is a dictionary with zoom level and the max error. {"15": 5, "16": 4, "17": 3, ....}
defaultMaxError
is set to 5 in the below example, when a zoom level is not present in the zoomMaxErrors
it will use the default value of 5.
http://localhost:5000/tiles/17/134972/21614.terrain?cog=MyCog&meshingMethod=martini&defaultMaxError=5&zoomMaxErrors={"15": 5, "16": 4, "17": 3, "18": 2, "19": 0.7, "20": 0.3, "21": 0.15, "22": 0.1}
Currently delatin can be used but CTOD does not create shared edge vertices nor does it average the heights and normals based on neighbouring tiles. The way that delatin meshes often results in vertices near the edge but not on the edge. Therefore there will still be visible seams between the tiles when viewed in Cesium.