Dynamic terrain with height-dependent textures?

I am trying to use BJS’s dynamic terrain (very attractive stuff indeed!).

I’d like to have different textures, depending on the height of the terrain, e.g. sand at the lowest level, then grass, then rock, then snow at the highest parts of the terrain. I’d also like to have rock where the slope is steep.

Q: How can I achieve this?

The dynamic terrain is simply a mesh (an updated ribbon). There’s no specific feature about its texturing, except the dynamic UVs computation in order to shift the texture with the terrain.

If you want to mix textures according to the terrain altitude, you could probably use the same shader than the WorldMonger demo one : Babylon Engine for HTML5


Thank you, Jerome, very good! I’ll have a look at that example.

Is there a playground available which utilizes this shader or do I have to extract it from the worldmonger source?

It is right here: Website/build/Scenes/WorldMonger/Shaders/Ground at master · BabylonJS/Website · GitHub

Great! I’ll have a look!

@jerome Jerome, thanks a lot for the inspiration! My shader starts to work:

Babylon rocks!