Using TerrainLighting.jm3d with 2 alpha Maps?

I read the documentation on TerrainLighting.jm3d, and it specifies that i can add more than 3 textures to my terrain using texture splatting:

https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:terrain

I have created 2 alpha maps and attached them to the Material like so:

    mat_terrain.setTexture("AlphaMap", alphaT);
    
    mat_terrain.setTexture("AlphaMap_1", alphaT);

They are the same alpha map at the moment.
I then created and attached all of the textures (6 total textures)
Now i am wondering, how do i create an alphaMap manually that will support 6 textures?
Does it use yellow or another color to define the other textures?

How do i manually created an AlphaMap for this situation?
Or do i create two seperate heightMaps?

Thanks :slight_smile:

You use two separate alpha maps. One supports 3 textures the other supports another 3 textures.

@TastyLemons said: I read the documentation on TerrainLighting.jm3d, and it specifies that i can add more than 3 textures to my terrain using texture splatting:

https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:terrain

I have created 2 alpha maps and attached them to the Material like so:

    mat_terrain.setTexture("AlphaMap", alphaT);
    
    mat_terrain.setTexture("AlphaMap_1", alphaT);

They are the same alpha map at the moment.
I then created and attached all of the textures (6 total textures)
Now i am wondering, how do i create an alphaMap manually that will support 6 textures?
Does it use yellow or another color to define the other textures?

How do i manually created an AlphaMap for this situation?
Or do i create two seperate heightMaps?

Thanks :slight_smile:

If you have an application that divides rgb in channels, you can create a layer… draw the map you want (black for transparent, white for opaque). Then disable all channels except 1. Say for instance the Red channel for this one.

Then repeat the process for the blue channel and the green channel

In the case of TerrainLighting.j3md … this will be the alpha map used for Diffuse Textures 0, 1 & 2

You have to use another alpha map like the one above to enable diffuse texture 3, 4 & 5

Here is some screens of how to make this work in PhotoShop:

Create a new layer, fill it with black and paint with white:

Select the Channel Tab, turn off all but red, then open the Layer Properties window and uncheck the green and blue channel:

Repeat this process for the green and blue channel… your final image will look like this:

Each channel is used as a separate alpha map…

red = alpha map for diffuse texture 0
green = alpha map for diffuse texture 1
blue = alpha map for diffuse texture 2

1 Like

I have created two Alpha Maps, and applied both of them to the Material using the code below, but somehow, they are overwriting each other:

alpha1

http://postimg.org/image/7aa0uzwjd/

alpha2

http://postimg.org/image/erj8a7m2h/

mat_terrain.setTexture(“AlphaMap”, alpha1);
mat_terrain.setTexture(“AlphaMap_1″, alpha2);

@t0neg0d said: If you have an application that divides rgb in channels, you can create a layer... draw the map you want (black for transparent, white for opaque). Then disable all channels except 1. Say for instance the Red channel for this one.

Then repeat the process for the blue channel and the green channel

In the case of TerrainLighting.j3md … this will be the alpha map used for Diffuse Textures 0, 1 & 2

You have to use another alpha map like the one above to enable diffuse texture 3, 4 & 5

Here is some screens of how to make this work in PhotoShop:

Create a new layer, fill it with black and paint with white:

Select the Channel Tab, turn off all but red, then open the Layer Properties window and uncheck the green and blue channel:

Repeat this process for the green and blue channel… your final image will look like this:

Each channel is used as a separate alpha map…

red = alpha map for diffuse texture 0
green = alpha map for diffuse texture 1
blue = alpha map for diffuse texture 2

I did everything you guys have explained. I made two heightmaps: see images above:

and i added them to the material as alpha1 and 2 but somehow they are overlaying one another. If i find a fix, ill write some documentation so that other people wont have the same issues as me :slight_smile:

If anyone else ends up here looking for why the materials are overwriting each other, see this post here:
http://hub.jmonkeyengine.org/forum/topic/setting-more-than-three-texture-splats/

Specifically the 4th post down. That should explain things (basically you want to set alpha to zero in all the red/green/blue areas of the alphamap).