Jump to content

VertexData.CreateGroundFromHeightMap always returning empty dataset


Recommended Posts

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?



Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...