Ok this will be my last post on the forums, but i really need this answered. I have been sitting here for the last 2 days, and my head is about to explode.
I have created a randomized Heightmap, and i have generated 2 AlphaMaps from this HeightMap using the following JMonkey Plugin:
from Thread:
http://hub.jmonkeyengine.org/forum/topic/heightmap-based-alpha-map/
Here are the results:
alpha1
http://postimg.org/image/7aa0uzwjd/
alpha2
http://postimg.org/image/erj8a7m2h/
The generator takes in the following arguments:
Texture1Height
Texture2Height
Texture3Height
MaxHeight
ARGUMENTS FOR ALPHA 1:
alphaGen.setMaxHeight(35.0f);
alphaGen.setTex1Height(0.0f);
alphaGen.setTex2Height(20.0f);
alphaGen.setTex3Height(30.0f);
ARGUMENTS FOR ALPHA 2:
alphaGen.setMaxHeight(70.0f);
alphaGen.setTex1Height(35.0f)
alphaGen.setTex2Height(40.0f);
alphaGen.setTex3Height(50.0f);
I am changing the max height so that Alpha 1 does not generate anything at a certain height, so that i can have 3 Textures for each half (height wise) of the terrain.
Now as i understand it, when i have two separate AlphaMaps, i can create up to 6 diffuse textures for my terrain. (Acording to the following Documentation):
(See section: Texture Splatting)
https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:terrain
So i applied both of the alphaMaps that were generated, to the material as follows:
mat_terrain.setTexture(“AlphaMap”, alpha1);
mat_terrain.setTexture(“AlphaMap_1″, alpha2);
So now the Terrain material has 2 AlphaMaps. So now the last thing i think i need to do, is add the diffuse textures:
Material mat_terrain = new Material(assetManager,
"Common/MatDefs/Terrain/TerrainLighting.j3md");
mat_terrain.setBoolean("useTriPlanarMapping", false);
Texture blnk = assetManager.loadTexture(
"Textures/Terrain/Diffuse/Grass.png");
blnk.setWrap(WrapMode.Repeat);
mat_terrain.setTexture("DiffuseMap", blnk);
mat_terrain.setFloat("DiffuseMap_0_scale", 128);
Texture dirt = assetManager.loadTexture(
"Textures/Terrain/Diffuse/Grass.png");
dirt.setWrap(WrapMode.Repeat);
mat_terrain.setTexture("DiffuseMap", dirt);
mat_terrain.setFloat("DiffuseMap_1_scale", 128);
Texture grass = assetManager.loadTexture(
"Textures/Terrain/Diffuse/Grass.png");
grass.setWrap(WrapMode.Repeat);
mat_terrain.setTexture("DiffuseMap_1", grass);
mat_terrain.setFloat("DiffuseMap_2_scale", 128);
Texture path = assetManager.loadTexture(
"Textures/Terrain/Diffuse/Grass.png");
path.setWrap(WrapMode.Repeat);
mat_terrain.setTexture("DiffuseMap_2", path);
mat_terrain.setFloat("DiffuseMap_3_scale", 128);
Texture road = assetManager.loadTexture(
"Textures/Terrain/Diffuse/Road.png");
road.setWrap(WrapMode.Repeat);
mat_terrain.setTexture("DiffuseMap_5", road);
mat_terrain.setFloat("DiffuseMap_4_scale", 128);
Texture rock = assetManager.loadTexture(
"Textures/Terrain/Diffuse/Stone.png");
rock.setWrap(WrapMode.Repeat);
mat_terrain.setTexture("DiffuseMap_4", rock);
mat_terrain.setFloat("DiffuseMap_5_scale", 128);
Texture snow = assetManager.loadTexture(
"Textures/Terrain/Diffuse/Snow.png");
rock.setWrap(WrapMode.Repeat);
mat_terrain.setTexture("DiffuseMap_3", snow);
mat_terrain.setFloat("DiffuseMap_6_scale", 128);
I added the blnk Diffuse at the start, because as i understand it, the first AlphaMap allows for 4 diffuse maps.
When i run this, it seems that Alpha 2 is completely overriding Alpha 1.
My questions are:
> Have i made any mistakes?
> Is this the correct way to apply 6 diffuse maps to a terrain
> What is the right way?
> Is there any further documentation?
I cannot thank you enough for your Time, and i truly appreciate all of your efforts in advance.
Thank You!