I have a very simple, straightforward use of ImageBasedHeightMap set up, but the second terrain texture used never seems to display properly. I have done this in the past, and it has worked without issue before, but this time it is weirding out. I even tried to copy/paste the heightmap part out of the hello terrain tutorial and modify to use my assets, but still no.
Right now I only have a grass texture and a dirt texture that I am using. Dirt is temporarily used for both textures 2 and 3.
In the screenshot, you can see that the grass shows up fine, but the dirt just looks solid light brown or tan. If I switch the textures around so that dirt is tex1 and grass is tex2, then the dirt shows up fine but the grass looks like a solid green.
As you can see from the following code, it’s basically just the Hello Terrain tutorial at the moment, so it should be fine.
[java]
Material terrainMaterial = new Material(assetManager, “Common/MatDefs/Terrain/Terrain.j3md”);
terrainMaterial.setTexture(“Alpha”, assetManager.loadTexture(“Models/splat.png”));
Texture grass = assetManager.loadTexture(“Models/grass.jpg”);
grass.setWrap(WrapMode.Repeat);
terrainMaterial.setTexture(“Tex1”, grass);
terrainMaterial.setFloat(“Tex1Scale”, 64f);
Texture dirt = assetManager.loadTexture(“Models/dirt.jpg”);
grass.setWrap(WrapMode.Repeat);
terrainMaterial.setTexture(“Tex2”, dirt);
terrainMaterial.setFloat(“Tex2Scale”, 32f);
grass.setWrap(WrapMode.Repeat);
terrainMaterial.setTexture(“Tex3”, dirt);
terrainMaterial.setFloat(“Tex3Scale”, 32f);
AbstractHeightMap heightmap = null;
Texture heightMapImage = assetManager.loadTexture(“Models/heightmap.png”);
heightmap = new ImageBasedHeightMap(ImageToAwt.convert(heightMapImage.getImage(), false, true, 0));
heightmap.load();
int patchSize = 65;
TerrainQuad terrain = new TerrainQuad(“my terrain”, patchSize, 1025, heightmap.getHeightMap());
terrain.setMaterial(terrainMaterial);
terrain.setLocalTranslation(0, -100, 0);
terrain.setLocalScale(10f, 2f, 10f);
rootNode.attachChild(terrain);
[/java]