Imported and slightly tweaked the Shader namespace functions from Terrain3D