Skip to content

Instantly share code, notes, and snippets.

@deltakosh
Created March 6, 2023 22:52
Show Gist options
  • Save deltakosh/01a6b8d548882f0bb1296edb1b79e7f6 to your computer and use it in GitHub Desktop.
Save deltakosh/01a6b8d548882f0bb1296edb1b79e7f6 to your computer and use it in GitHub Desktop.
// Create an heightmap
var heightmap = new BABYLON.DynamicTexture("heightmap", {width:1024, height:1024}, scene);
heightmap.update();
var context = heightmap.getContext();
// Plug the heightmap in the node material
var textureBlocks = matCap.getTextureBlocks().filter(b => b.name === "HeightMap");
if (textureBlocks && textureBlocks.length) {
textureBlocks[0].texture = heightmap;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment