twCommon.shaderModule
The shared WGSL vocabulary every Tidewater water surface shades with, included as `#include "~.shaderModules.twCommon"`. Pure `tw_*` functions over values the caller passes in (it reads no `material.*` field), so lakes, ponds, pools, puddles (`shaders/waterSurface`) and rivers /…
twCommon
The shared WGSL vocabulary every Tidewater water surface shades with, included as
#include "~.shaderModules.twCommon". Pure tw_* functions over values the caller
passes in (it reads no material.* field), so lakes, ponds, pools, puddles
(shaders/waterSurface) and rivers / waterfalls (shaders/riverSurface) share one look.
What it gives a shader:
- Looks:
TwLook,tw_look(...),tw_is(look, mode),tw_band,tw_band_ramp,tw_posterize,tw_pixel_snap,tw_brush(painterly strokes),tw_toon_specular,tw_facet_normal(lowpoly),tw_saturate_color,tw_luma. - Normals:
tw_detail_slope(xz, t, scale, strength, flow)layered scrolling gradient noise (two-phase along a flow vector),tw_swell(the analytic sine swell the vertex hook displaces by),tw_slope_normal. - Flow:
tw_flow(flow, time, period) -> TwFlowtwo-phase scrolling offsets + blend weight. - Ripples and rain:
tw_ripple_slope(map, sampler, region, xz, strength)/tw_ripple_heightsample the GPU ripple fieldmodules/rippleskeeps on every bound material (ripple_map,ripple_region);tw_rain_rings(xz, t, amount)procedural raindrop rings finer than the field. - Optics:
tw_fresnel(exact dielectric, TIR),tw_sun_glint(GGX),tw_screen_uv,tw_behind(uv, surface, eye) -> TwBehind(bed world position, view-ray travel and vertical column from the scene depth),tw_scene_color,tw_refract_uv,tw_transmittance,tw_depth_color(Beer-Lambert). - Caustics and foam:
tw_caustics(bed_xz, t, scale)projected at the reconstructed bed,tw_shore_foam(lace where the column is thin),tw_outline_foam(crisp toon bands).
Reads the scene behind the surface through the engine's zero::scene_depth and
zero::scene_color, so the including material should draw in the transparent queue.
Scoped to this part · feeds back into the world's score.