Ron Posted May 19, 2014 Share Posted May 19, 2014 Hi all, I am new here so excuse me if this is the wrong section of the forum to ask this question. I have created 2 planes from 2 different heightmaps (which have almost similar edges)when i place the 2 planes next to each other, there are some gaps in between them (some places are higher than the other on the line between the 2 planes) is there any way to join those 2 heightmaps? i know it is possible by merging the 2 heightmap images and create one plane of that, but the reason i don't want to do it is that generation of each plane is dynamic (unlimited world) see attached image as an example Thanks in advance Quote Link to comment Share on other sites More sharing options...
gwenael Posted May 19, 2014 Share Posted May 19, 2014 Hello Ron, Welcome! First, since the planes have almost similar edges you get the expected result: gap between "planes" (they are not really planes since the normals can change from a point to another one). Secondly, to stich them you can set the vertices positions along the edges but you need the same number of vertices along the two edges to stich and they must be "in front of" each other. To set the vertices positions you can use [setVerticesData](https://github.com/BabylonJS/Babylon.js/blob/master/Babylon/Mesh/babylon.mesh.ts) Quote Link to comment Share on other sites More sharing options...
Ron Posted May 20, 2014 Author Share Posted May 20, 2014 Thanks for the info gwenaelall "planes" or terrains are 100x100 and built from an 100x100 pixel heightmap image (with max of 25 "things" in the API - sorry i don't know the name, just know that the more this number the more details are built) so i think they have same number of vertices along the edges (am i right :s ?) . how can i iterate through the vertices of the edges and give them the same height of the other edge (i will average them later on just need to know how to access them ...) Quote Link to comment Share on other sites More sharing options...
Ron Posted May 20, 2014 Author Share Posted May 20, 2014 Oh and the edges of the generated terrains are darker than expected (the texture have only one color, in PNG format, tried JPG with 0% compression, same dark edges ) how can this be fixed ? otherwise even after stitching the 2 planes/terrains there will be a visible border because of the darker borders ... that's weird. any solution? or this maybe a bug? Quote Link to comment Share on other sites More sharing options...
gwenael Posted May 20, 2014 Share Posted May 20, 2014 Thanks for the info gwenaelall "planes" or terrains are 100x100 and built from an 100x100 pixel heightmap image (with max of 25 "things" in the API - sorry i don't know the name, just know that the more this number the more details are built) so i think they have same number of vertices along the edges (am i right :s ?) . how can i iterate through the vertices of the edges and give them the same height of the other edge (i will average them later on just need to know how to access them ...) Yes they must have the same number of vertices. To get the vertices positions you must use getVerticesData from the Mesh class. Quote Link to comment Share on other sites More sharing options...
Ron Posted May 21, 2014 Author Share Posted May 21, 2014 Thank you! fixed it gwenael 1 Quote Link to comment Share on other sites More sharing options...
gwenael Posted May 21, 2014 Share Posted May 21, 2014 Can I see the result? (please, don't forget to set the topic as resolved. You could paste the relevant part of your code) Quote Link to comment Share on other sites More sharing options...
binyan Posted May 23, 2014 Share Posted May 23, 2014 Oh and the edges of the generated terrains are darker than expected (the texture have only one color, in PNG format, tried JPG with 0% compression, same dark edges ) how can this be fixed ? otherwise even after stitching the 2 planes/terrains there will be a visible border because of the darker borders ... that's weird. any solution? or this maybe a bug? Asking the same question. Quote Link to comment Share on other sites More sharing options...
Ron Posted June 2, 2014 Author Share Posted June 2, 2014 Hi gwenael , actually I written some code to make the edges of the terrain heightmap equal as there were some problems, but still some heightmaps doesn't appear, i am attaching some of the heightmaps ... , when i create simple planes it works great, but when I put the heightmaps, they don't show up.terrains.zip 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.