Heightmap visualizer

Hi, I am working on a world generation with simulation of plate tectonics, erosion, rainshadow, etc. etc. etc. (GitHub - ftomassetti/worldgen).

I am trying to use jMonkeyEngine to visualize the map. I managed to load my HeightMap but I don’t manage to use the right textures for each point. I am using an AlphaMap:

ByteBuffer textureData = ByteBuffer.allocateDirect(map_widthmap_height3+1);

  for (int y=0;y<513;y++){
    for (int x=0;x<513;x++){
char r=0,g=0,b=0;

// set either r or g or b at 255.0 depending on some logic

Image textureImage = new Image(Image.Format.RGB8,513,513,textureData);
Texture alpha_texture = new Texture2D();
mat_terrain.setTexture(“Alpha”, alpha_texture);

If I use my programmatially built alpha texture nothing is shown :frowning:

Any idea?

@ftomassetti You’re passing in a number between 0 and 255, when ColorRGBA or any other color constructor in jME3 takes numbers between 0.0 and 1.0. Simply divide your total number by 255.0 and that should help.