Skip to main content

Module descriptors

Module descriptors 

Source
Expand description

CPU → GPU packing of the shared terrain-noise parameters.

Both the geometry realize and the surface-detail bake read the same 56-byte TerrainGpu block. The CPU splits ownership into two layer structs (HeightGpu geometry, TextureGpu albedo) so a colour-only edit can route through the graph without re-staging geometry; assemble packs them back into the single block the shaders read.

Structs§

HeightGpu
The height (geometry) layer’s params: everything that displaces the surface and is the input to the derived albedo. Owned by the height-layer node; a change re-stages geometry. enabled globally toggles terrain displacement.
TerrainGpu
Terrain noise parameters as the shaders read them (14 floats = 56 bytes, matching struct TerrainGpu in the realize/bake shaders — the CONTAINING params structs pad back up to a 16-byte multiple). Octave counts ride as floats and are cast in-shader.
TextureGpu
The texture (albedo) layer’s params. Most albedo is derived from the height field, so this is currently just the water-colouring threshold — but owning it as a separate layer lets a colour-only change route through the graph without re-staging geometry, and is where future albedo tunables land.

Functions§

assemble
Pack the two layer structs into the single 56-byte TerrainGpu the realize and bake shaders read. Field order/positions are unchanged — the split is CPU-side ownership only, so no shader or SPIR-V change is needed.