Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commit65083fe8f2

README.md

ocean_normals

Differentiates one cascade's displacement field into a shading normal and a foam mask. Normals come from central differences of the displaced positions (so crest pinching is accounted for, unlike a height-only gradient), with wrap-around neighbours because the cascade tiles. Foam comes from the smaller eigenvalue of the horizontal displacement Jacobian: where it goes negative the surface has folded over itself, which is what a breaking wave is — so whitecaps appear from the same displacement that raised the crest rather than from a painted-on noise threshold. Fresh foam replaces the stored value immediately while old foam fades at foam_decay per second, leaving streaks behind broken crests.