Last active
July 5, 2021 17:09
-
-
Save mattdesl/afaf417ebc6f36d2e12161ca3f1c4449 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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