Builtin Library
README.md
oceanFloor
The ground the water is seen through. It spans the same extent as the clipmap,
follows the viewer the way the surface does, and is shaded by
~.shaders.oceanFloor.
One noise field is the whole terrain: scaled it is the relief the seabed's vertex stage raises the grid into, and read again unscaled it picks between sand and rock. Over both moves the sun's caustic web, displaced by the horizontal displacement of the water directly above it.
The seabed applies no absorption of its own. The water column belongs to the surface shader, which knows the real distance light travelled through water; attenuating here as well would darken the ground twice.
Its three tiling maps are grown once by ocean_floor_texture — the same
compute-texture path the cascade maps take — so the seabed carries no binary
asset and no content reference that could fail to resolve.
local Floor = require("@builtin::systems.oceans.modules.oceanFloor")
local floor = Floor.create({
config = cfg, -- a resolved ocean config
extent = 12800, -- the clipmap's own extent, metres
prefix = "ocean1_floor_",
name = "Seabed",
})
floor:bindWave(cascadeDisplacementTexture, cascadeTile)
floor:step(elapsed, viewerX, viewerZ)
floor:destroy()
Ocean creates and drives one of these itself whenever the sea state's floor
block is enabled, so a scene that uses the Ocean component gets a seabed
without naming this module at all.