Texture terrain based on height?

In jME2 it was possible to apply different textures to different height ranges on a terrain block (so heights 0-50 get one texture, 50-100 another, etc). Is that still possible in jME3?

Thanks very much!

Yeah … sort of - you can get the same effect.

You use an image to choose which … sub-textures (snow, dirt, grass) to use on the final terrain. You’re limited to 3 textures - they say they’re working towards 16, and you also can’t (easily) pre-compute the texture like in JME2 - but you achieve ridiculously higher image resolution than you could in JME2.

1 - Read this - https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:beginner:hello_terrain

2 - Take your height map and just put the color that corresponds to the texture you want.

3 - I.E. if you want “dirt” at 0-50 then use dirt as your “red / tex1” image, then scan your heighmap, and put out a “red” pixel at the corresponding height.

4 - Follow through for the other channel and you’ll have a new version of their “Textures/Terrain/splat/alphamap.png” file which will do what you want.

Does that need clarification?

I was afraid I would have to do it like that… Thank you though!

You could use the NetoTextureEdit plugin’s Image and Colorize functions to generate your m_AlphaMap

Add an image node and set the file parameter to your grayscale file. Then add a Colorize node which takes the image as input and has red, green, and blue functions. You could either export the image then and there or use the loader thing to load it as a texture which would be procedurally generated