Skip to content

Instantly share code, notes, and snippets.

@mattdesl
Last active July 5, 2021 17:09
Embed
What would you like to do?
function parametricTerrain ([ u, v ]) {
// Turn 0..1 to -1..1
const x = u * 2 - 1;
const z = v * 2 - 1;
// Find height at this 2D coordinate
const y = calculateTerrainHeight(x, z);
// Return the 3D surface point
return [ x, y, z ];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment