diff --git a/.env b/.env index 10bc08757..5160d4c9b 100644 --- a/.env +++ b/.env @@ -1,4 +1,4 @@ PUZZLE_URL=https://cptschnitz.github.io/map-tile-puzzle/ CATALOG_APPLICATION_URL=https://github.com/MapColonies -YAHALOM_APPLICATION_URL=https://github.com/MapColonies +YAHALOM_APPLICATION_URL=https://github.com/MapColonies PLAYGROUND_URL=https://sandcastle.cesium.com/ diff --git a/docs/MapColonies/DEM/Services/CesiumTerrainProvider/README.md b/docs/MapColonies/DEM/Services/CesiumTerrainProvider/README.md new file mode 100644 index 000000000..f5905dd6a --- /dev/null +++ b/docs/MapColonies/DEM/Services/CesiumTerrainProvider/README.md @@ -0,0 +1,221 @@ +--- +id: dem-terrain-provider +slug: info +title: Terrain Provider +description: Service to provider DTM surface provider for cesium +tags: + - dem + - API + - elevation + - dtm + - height + - coordinate +--- + +# Quantized Mesh Provider (Cesium.js Terrain Provider) + +## Understanding Quantized Mesh +Quantized Mesh constitutes a highly efficient binary format, meticulously engineered for the purpose of streaming three-dimensional terrain elevation and normal data across networked environments. This specification, developed under the auspices of the Cesium team, directly addresses the inherent complexities associated with the transmission of voluminous terrain datasets through the implementation of a sophisticated quantization schema. This methodology demonstrably reduces data payload while rigorously preserving the fidelity of visual representation. In contradistinction to conventional terrain formats predicated upon heightmap methodologies, Quantized Mesh directly encodes triangular mesh data. This foundational architectural decision confers a plurality of salient advantages: + +
+ +
+ +* Data Efficiency: Quantization effects a reduction in the precision of vertex coordinates (X, Y, Z) and associated normals to a predetermined number of bits, typically within the range of 12 or 16-bit unsigned integers. The consequence of this process is a substantial diminution in file sizes, thereby facilitating accelerated download times and a concomitant reduction in network bandwidth consumption. + +* Progressive `Level-of-Detail (LOD)` Streaming: The format inherently supports a progressive loading paradigm. This capability empowers client-side applications to dynamically solicit and render terrain tiles of progressively higher resolution as the user's viewpoint converges upon a specific geographical area, thereby optimizing rendering performance and enhancing the interactive user experience. + +* Integrated Normals: Quantized Mesh tiles possess the optional capacity to incorporate pre-computed vertex normals. The inclusion of these normals is deemed critical for the enablement of accurate per-vertex lighting and shading, an indispensable prerequisite for the rendering of visually verisimilar three-dimensional terrain. + +* Water Masking Capability: The specification encompasses provisions for water masks. These masks precisely delineate aquatic bodies within a given terrain tile, thereby facilitating the accurate rendering of water surfaces and their interactive relationship with the contiguous terrestrial environment. + + +## Anatomy of a Quantized Mesh Tile +A Quantized Mesh tile is structurally defined as a binary data block, meticulously organized into several discrete sections to facilitate efficient parsing and subsequent rendering operations: + +1. Header: This initial segment contains essential metadata pertaining to the specific tile. Crucial information encompassed herein includes the tile's bounding box, delineated in geodetic coordinates (comprising longitude, latitude, and height range), the minimum and maximum terrain heights present within the tile, and the aggregate count of vertices. + +2. Vertex Data: This foundational section stores the quantized positions (X, Y, Z coordinates) of all vertices, expressed relative to the tile's localized coordinate system. These positions are typically subjected to quantization to a 16-bit unsigned integer range, which subsequently undergoes de-quantization on the client-side. + +3. Triangle Data (Indices): This section defines the topological connectivity of the vertices, thereby forming the triangular facets of the terrain mesh. This data typically employs variable-length encoding, such as zig-zag encoding, to further augment compression efficacy. + +4. Edge Indices: This critical section specifies the indices of those vertices situated along the tile's four peripheral edges. These edge indices are of paramount importance for ensuring the seamless stitching and continuous integration between adjacent terrain tiles, thereby precluding the occurrence of visual discontinuities or gaps. + +5. Normal Data (Optional): Should the terrain dataset incorporate per-vertex normals, this section accommodates their quantized representations. These normals are employed by the rendering engine for the execution of precise lighting calculations, thereby contributing significantly to the visual verisimilitude of the terrain. + +6. Water Mask (Optional): This section, if present, contains a binary mask serving to identify areas encompassed by water within the confines of the tile. This mask is subsequently utilized by Cesium.js for the application of appropriate water rendering effects. + +7. Metadata (Optional): This flexible section permits the inclusion of additional, arbitrary metadata specific to the terrain provider or the dataset itself. + +The process of quantization involves the mapping of original floating-point geographic coordinates and heights to a compact range of integer values. These integer values are then transmitted with efficiency. Upon receipt, the client-side rendering engine executes the inverse operation, de-quantizing these integers back into floating-point numbers, which are then suitable for three-dimensional rendering. + +## Integrating a Quantized Mesh Provider with Cesium.js +`Cesium.js` provides robust, inherent support for the consumption of Quantized Mesh data through its `Cesium.CesiumTerrainProvider` class. This class intelligently manages the entire lifecycle of terrain data, encompassing the request for tiles, the parsing of binary data, and the efficient rendering within the three-dimensional globe environment. + +For the successful configuration of a `CesiumTerrainProvider`, the primary requisite is the `Uniform Resource Locator (URL)` of a server endpoint that strictly adheres to the Cesium Terrain Server specification for the provision of Quantized Mesh tiles. + +## Step-by-Step Configuration +Dependency Inclusion (Cesium.js): It is imperative that the `Cesium.js` library and its associated `CSS` are correctly incorporated into the `HTML` document. This objective may be achieved through the referencing of the Cesium `Content Delivery Network (CDN)` or by means of local hosting of the library. + +```html + + + + + ++ +
+ +## Conclusion +Quantized Mesh is established as a highly efficacious and efficient format for the streaming of three-dimensional terrain data, serving as a foundational element for high-performance geospatial applications. Through the meticulous utilization of the `Cesium.CesiumTerrainProvider` class, developers are afforded the capability to seamlessly integrate and visualize extensive terrain datasets originating from their proprietary custom terrain servers within their `Cesium.js` applications. This integration facilitates the creation of rich, interactive, and visually compelling three-dimensional globes featuring realistic terrain rendering, thereby significantly augmenting the user's geospatial exploration experience. diff --git a/static/img/dem/elevated_terrain.webp b/static/img/dem/elevated_terrain.webp new file mode 100644 index 000000000..8e2824e87 Binary files /dev/null and b/static/img/dem/elevated_terrain.webp differ