Jump to content

Prevent vertical stripes in babylon mesh


Ravi Kiran
 Share

Recommended Posts

Hi,

 

I am trying to draw a mesh using a heightmap and its texture. The mesh is getting plotted, but I see vertical stripes in the structure drawn. The following image shows this:

image.png.81535cfe678bb67e221ee2bafda4b7dc.png

Is there a way to prevent the stripes and just have the structure? I tried a number of options but wan't lucky enough to figure it out by myself.

Here is the demo I created on playground: https://playground.babylonjs.com/#2WFHNI

Link to comment
Share on other sites

23 minutes ago, Gijs said:

Hi, you can lower the maxHeight parameter of CreateGroundFromHeightMap:

https://playground.babylonjs.com/#2WFHNI#1

Thanks, that reduces the height of the object drawn. I want the object to be floating at the specified height without the stripes. In my project, the heightmaps I receive are like rocky surfaces with their edges not touching the ground. For that I have to set a fixed height to the mesh, similar to the example I created but my users don't want to see the stripes.

Link to comment
Share on other sites

You can modify BABYLON.VertexData.CreateGroundFromHeightMap to check if a point is in the transparent zone, and set the height to a custom value. If you set it to a special value you can recognize later, you can use that in the part where the indices are set, and correct one or two of the "transparent" vertices. An added bonus is that if all three vertices are "transparent", you can leave the triangle out completely (save on geometry)!

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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

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