Expand description
§surtgis-relief-3d
Native wgpu 3D viewer for SurtGis shaded relief. Renders a DEM as a displaced, textured mesh in a native window (winit) or a browser canvas (WebGPU / WebGL2 fallback).
Status: M1 spike — skeleton only. Builds a wgpu pipeline and
renders a 1024×1024 textured plane (1M vertices) to validate
production-workload performance. M2 wires real DEM heights and the
surtgis-relief texture; M3 adds lighting; M4 ships WASM/browser;
M5 adds headless screenshots. See SPEC_SURTGIS_RELIEF_3D.md.
Modules§
- camera
- Orbit camera with mouse interaction.
- headless
- Offscreen render path — no winit window, no canvas, no display.
- lod
- Quadtree LOD for DEMs that don’t fit in a single full-resolution mesh upload (~ 1 M vertices is the practical native ceiling).
- martini
- Martini RTIN (Right-Triangulated Irregular Network) terrain meshing.
- mesh
- Grid mesh generation.
- native
- Native winit-driven window + event loop.
- pipeline
- wgpu device + render pipeline construction.
Structs§
- Uniforms
- Per-frame uniforms — 144 bytes, every field a vec4 slot to keep the
std140-equivalent layout obvious on both sides of the FFI:
view_proj : mat4x4
(offset 0, 64 B) light_dir.xyz : vec3 in vec4 (offset 64, 16 B) // direction TOWARDS light light_color.xyz / .w : colour + amb. (offset 80, 16 B) vertical_scale.x : f32 in vec4 (offset 96, 16 B) fog_color.xyz / .w : colour + density [0,1] (offset 112, 16 B) fog_range.x / .y : near / far stops (offset 128, 16 B) - Vertex
- Vertex layout. Position + UV + normal — 8 floats per vertex.
Normals are computed at “baseline” vertical exaggeration; the shader
re-orients them per-frame when the user changes the runtime
vertical_scaleuniform. - VertexC
- P4-M3b vertex compression. 16 bytes per vertex (half the f32 layout).
Used as the GPU-side storage format by
pipeline::build_pipeline, which converts&[Vertex]→Vec<VertexC>once at upload time.
Enums§
Functions§
- sun_dir
- Unit vector pointing from the surface toward the sun. Convention
matches
RayShadeParams::with_soft_shadow_altitude(azimuth 0=N, clockwise; altitude 0=horizon, 90=zenith).