Skip to main content

Module normals

Module normals 

Source
Expand description

Vertex-normal computation for terrain meshes.

Two strategies are provided:

  • face_normals — accumulates triangle normals onto vertices. Simple but produces a visible seam at tile boundaries because each tile only sees its own triangles.
  • buffered_gradient_normals — samples a buffer-extended DEM grid that covers cells beyond the tile on every side. Adjacent tiles read the same samples at any shared physical position, so seam vertices get identical normals on both sides and lighting is continuous.

Both functions return ECEF normals (Cesium’s convention for oct-encoded normals stored in quantized-mesh tiles).

Structs§

BufferedElevations
Elevations sampled on a grid that extends buffer cells beyond the tile on each side.

Functions§

buffered_gradient_normals
Compute vertex normals from the DEM gradient on a buffer-extended grid.
face_normals
Compute vertex normals by accumulating triangle face normals onto each vertex (then renormalising).