Provide `MeshBuilder.CreateGroundFromHeightMap` taking an image instead of an URL

Hi all!

I’m using AssetsManager to load my assets and would like to use it for a terrain heightmap as well.
MeshBuilder.CreateGroundFromHeightMap taking an already loaded image instead an URL-string as a parameter would be helpful for that.


. J

… or even a Uint8Array as VertexData.CreateGroundFromHeightMap does, so that AssetsManager can prepare as much as possible upfront.

+1 from my side, would be great having this possibility!

The url can be constructed from a blob if you want to:

            var blob = new Blob([data], { type: "octet/stream" });
            var url = URL.createObjectURL(blob

Then you can use that url with the MeshBuilder

Yes. I agree, this request is more for convenience than essential.

But this is more of a workaround? My goal was making terrain creation quick by using a preloaded image.
Loading image, creating a potentially multimegabyte URI that has to get parsed again does not sound to be ‘quick’.

What already helps today is preloading the image in AssetsManager. MeshBuilder.CreateGroundFromHeightMap then will not load it again from the web. Babylon or the browser seems to cache…

Yes and this is why I see not a real need as you can simply reload it and trust the browser cache (which will be really fast )

1 Like