Fine tuning a terrain heightmap

Ok so i have a few things to discuss and a few questions for anyone whos knows.

I currently have a texture map with 3 textures into the RGB slots. My “grass” texture ® works fine. My G and B textures, for dirt and rock are all completely monotone (brown and grey respectively) and very scrunched and messed up along one side. That is one issue im having, idk if its code or not or just bad images.

[java]mat_terrain = new Material(assetManager,


mat_terrain.setTexture(“Alpha”, assetManager.loadTexture(


Texture grass = assetManager.loadTexture(



mat_terrain.setTexture(“Tex1”, grass);

mat_terrain.setFloat(“Tex1Scale”, 128f);

Texture dirt = assetManager.loadTexture(



mat_terrain.setTexture(“Tex2”, dirt);

mat_terrain.setFloat(“Tex2Scale”, 128f);

Texture rock = assetManager.loadTexture(



mat_terrain.setTexture(“Tex3”, rock);

mat_terrain.setFloat(“Tex3Scale”, 128f);

AbstractHeightMap heightmap = null;

Texture heightMapImage = assetManager.loadTexture(


heightmap = new ImageBasedHeightMap(heightMapImage.getImage());


Is that code.

Next i want to discuss how best to get detail and scaling done with terrain height maps. My current height map is 1024x1024 with a patch size of 65. First, what does patch size control and what does changing it do? Second, how do the x and z scaling work with z scaling? I could see no difference at all in height colors unless the Y in terrain.setLocalScale(1f, 64f, 1f); is well above 10 or so. 128 and 64 work ok so far. And changing x and z seem to double or triple if its (2 of 3) where 1 seems to be the base size. So how do patch size and the scalings all come together to make good height maps?

We would need a picture of the “scrunched” texture to see what is going on. You can try playing with the scale parameter for each texture.

This tutorial talks about terrain patches; they are the geometry chunks of terrain.

To scale the terrain just set it with terrain.setLocalScale(x,y,z) as you would any other geometry. Heightmap generation has to pick a range so scaling there isn’t that useful, do it after the terrain is generated.