Randomly generated alphamap?

Hi guys,

I’m writing a controllable random terrain generator for my game. I can randomly generate heightmaps, but not alphamaps. From what I’ve seen, the problem is even if I did generate my own Image by passing in a ByteBuffer containing RGB data (which I can generate), I cant create a texture from that image. I would have to write that image to disk, and then call assetManager.loadTexture() on the new file.

I dont really want to modify my local source of JME3 for this - can anyone think of a better idea?

You can access the alpha maps directly and modify them without having to save them to disk.


matParam = terrain.getMaterial().getParam("AlphaMap");

Texture tex = (Texture) matParam.getValue();

Image image = tex.getImage();

ByteBuffer buf = image.getData(0);


Check out PaintTerrainToolAction from the SDK source for a full working example of modifying the alpha maps.

Thanks, will have a look at that.