joshcamas Posted October 3, 2018 Share Posted October 3, 2018 Hello friends I am visiting Babylon once again for a lil bit, and have an issue. Seems like no matter what I do, the function VertexData.CreateGroundFromHeightMap always returns an empty vertex data. The documentation is sort of unclear of what the buffer input is supposed to be - it says " buffer the array holding the image color data ", which sounds like it could be an array of rgba's, (sort of like canvas image data), but it also could mean rgb... but honestly both of those sound very strange, since a heightmap is greyscale, so it would make sense if it was simply an array of heights... but I'm assuming not since it says "image color data". How does this work? Thanks! Josh Quote Link to comment Share on other sites More sharing options...
JohnK Posted October 3, 2018 Share Posted October 3, 2018 Here is the doc on creating a ground with with height map https://doc.babylonjs.com/how_to/set_shapes#ground-from-a-height-map The heights are taken from a greyscale image since an image will cover all the mesh and so can be used however many vertices make the mesh. Also you can use a greyscale mesh that exactly matches the texture used on the mesh. Quote Link to comment Share on other sites More sharing options...
jerome Posted October 4, 2018 Share Posted October 4, 2018 Maybe you're trying to accessing the data before they are created. Remember that there is a delay due to the image file download, that's why the use of a callback function is required Quote Link to comment Share on other sites More sharing options...
joshcamas Posted October 4, 2018 Author Share Posted October 4, 2018 I managed to get it working, without really realizing what I was doing wrong. Well, I guess if it works now I shouldn't worry about it :^) But yeah I'm not using image data, I'm building the data during runtime. (And didn't want to convert to an image, since there really isn't a reason to do that) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.