pub fn buffered_gradient_normals(
vertices: &QuantizedVertices,
bounds: &TileBounds,
buffered: &BufferedElevations,
) -> Vec<[f32; 3]>Expand description
Compute vertex normals from the DEM gradient on a buffer-extended grid.
For every vertex the local east/north slope is read from the same DEM
samples that the neighbour tile would read — so the same physical edge
sees the same gradient from either side, eliminating the tile-boundary
shading seam that face_normals exhibits.
§Pipeline
- Map the vertex’s
(u, v)into the buffered grid’s index space. - Sample the buffered grid bilinearly at a half-cell stencil to get
the central differences
∂h/∂xand∂h/∂y(metres per metre). - Build a local ENU normal
(-∂h/∂x, -∂h/∂y, 1)and rotate it into ECEF, which is what Cesium expects for oct-encoded normals.
The returned vectors are unit-length ECEF normals.