HOWTO: Seamless DynamicTerrain from heightmap?

just having an idea about another approach than hidden points… could work, need to test, etc

1 Like

Time left to claim the 50$:



More seriously, I have contributed to BJS (+documentation, +API doc, +extensions, +forum) for something like more than 8K lines of code only for the framework itself so far. I wouldn’t have claim any money even if I would have fixed an extension bug within an user expected delay :wink:


I am with @jerome on this. I help out on the forum when and where I can in my own time scale. When I see an issue I can solve, and these are becoming rarer these days as the problems move away from the basic, if I have time I will give it a go. Fairly recently I was offered, in a PM, a reasonable payment to solve a fairly simple problem but if I had accepted that would have changed my relationship with the forum and my raison d’etre for helping out. Don’t get me wrong if people want to pay for help or offer services then I am happy there is a sub-forum for this. It is the direct approach I, personally, find uncomfortable. For a start that would mean all the extra work of negotiating and writing a proper contract so that expectations on both sides are clear. Casual agreements can go wrong all to soon.

Also I know that the comment

was meant as a joke and perhaps I am too sensitive and its my problem but it niggles. It, for me, suggests something along the lines of “You are desperate so I will buy your $6000 car for $50 as that way you will have some money rather than nothing”.

This is not really the forum to carry on any debate about this post please re-direct any response to contracts - How to Respond To Casual Agreement - Freelancing Stack Exchange


Yea, I meant no offense :wink: I don’t feel entitled that anyone should go out of their way just because I am having issue with something here. I understand that people’s time is money and hence why I thought it might somehow make it better for jerome to work on this. I am myself too stressed out perhaps about this and shouldn’t have projected it. Now I see how it is and would like to extend my apology and say this:

I am so grateful to all the devs here who have contributed to BabylonJS, it’s the future of web!

1 Like

no worries :wink:
And I’m still thinking about a way to fix this. I dislike to leave a bugged piece of my code to others.
But it’s complex, and my brain works on this in background… solutions come, just wait for them to hatch


Yea, with something as complicated as this, it might take a while for the revelation to come :stuck_out_tongue: Totally get this!

fixed : fix seam map when using a mapUvs by jbousquie · Pull Request #186 · BabylonJS/Extensions · GitHub

demo : BabylonJS Flight Simulator

quite painful to solve … :stuck_out_tongue:


Excellent, love it (the simulation not the pain you went through :smiley:)

1 Like

Loving it !!! GG @jerome !!!

the development prototype : Test Babylon Terrain
the Z seam is between both yellow lines
the X seam between both white lines

1 Like

I have done this, and it is your normal calculations.

You have to account for the fact that the sampler is going to not get the correct values at the edges unless you account for it and place a bleed zone for the sampler.

Are you using procedural noise to displace the terrain or texture maps?

Ohh nevermind jerome fixed it.

1 Like

I work on the terrain (ribbon) geometry by dynamically folding/compressing two quads along the seam and recomputing their vertex uvs so their neighbors (the now visible quads along the seam) get a correct texturing.

1 Like

Sounds about right!

When I was doing it with GPU generated noises for heightmaps the solution was to generate a 16 pxl bleedzone to account for mips that was basically the noise sample from the neighboring zone.

That’s all texture based though and uses the Vertex Shader to handle all of it.

Hey, thanks for your hard work! So does this fix issue for a terrain with standardMaterial with a single texture, yes?

Or should it also fix it for the terrainMaterial with multiple diffuseTextures?

<3 You da best

jerome, I tested it out on my example that I am building and unfortunately I’m still encountering a bit of an issue!

Take a look at this:

I have sent you a private message with the code of my example, to make it easier for you to debug this. It seems to be somewhat fixed. Perhaps it is my shitty code breaking it though? :sweat_smile:

The fix is only for the DynamicTerrain. It has nothing to do with the terrainMaterial (I don’t even know if there"s an issue there).

1 Like

mmh… maybe something with the normals on this place.
Don’t you have a repro in the playground with this specific case ? it could really help

1 Like

Hurray! It was my own derpy code that was causing the issue. After starting again from scratch I now have perfect infinitely scrolling terrain with your provided fix! Thank you so much jerome, I hope you have amazing Christmas and new year’s eve! Also if you’d like to own some btc, you can still send me address. I will hold up what I promised you as you did me!


1 Like

Having grateful people that love my work is enough for me :wink: thanks

1 Like