Heightmap based alpha map

hello folks,

in order to make my randomly generated test-terrains look a little bit nicer, i wrote a little alpha map generator that creates alpha maps based on the height of the terrain. That way beaches were sandy and mountains were rocky now in my terrain :smiley:

I wondered that there is nothing like this in jme included, so i decided to put this up on GitHub so everyone can use it, if yu want to.

Source code is there:


It lacks a little documentation, but i will update javadoc as i get the time. but i should be self-explanatory.

here are some example pictures from my last generated terrain:

the generated alpha map:

Of course it’s not perfect. the changes could be smoother etc.pp. but i think its a good starting point.


Cool, this could easily be made a right-click item for terrain in the SceneComposer, any interest in doing that?


Glad you like it :smiley:

I must honestly say, i have NO experience what so ever with writing plugins for netbeans (i’m myself more of a eclipse user, using netbeans only for the scene composer right now). Anyway, if you think thats a good feature for jMP, i will give it a try.

I’m currently thinking about adding support for more than three heights - TerrainLighting.j3md supports up to three alpha maps, so i could make it generate more then one map. So maybe i will update this a little bit at first and then add it to the scene composer :wink:

Alright, cool. Its all very easy, everything you need to do to prepare development and start a plugin is laid out in the wiki really. The class I posted in the previous post is all you need to implement in addition to your own classes.

Looks nice. It would definitely be cool to have as a plugin to the SDK.

I have made some advancements to the code, you can check it out at github (link in the first post).

I do not longer use a BufferedImage and convert this to a jME3 Image later, but write directly to a ByteBuffer from which the image is constructed in the end.

Anyway, i have also changes the saving method, so the image can still be easily exported to a .png file.

I hope these changes will allow me to blend the areas together more smoothly in the future (i will definitely work on that).