AlphaMap HelloTerrain Confusion

Hi,I’m new to JMonkey engine.
It’s excellent engine.
However,I’m still trying to figure out that how does alpha map in the tutorial figures out that tex1 is the red color in the map and tex2 the blue color and so on.
And what if:
1.> If i use different shades of color like yellow,orange,etc
2.>If my terrain is complicated and have to use different shades of red!

P.S: I know that Terrain Plugin and other AWESOME plugins :smiley: are available,but i want to do stuff with codes.!
The heightmap concept and related stuffs are explained very lucidly in the documentation but it lacks this information.
And many beginners might have the confusion as me :stuck_out_tongue_winking_eye:

The shader doesn’t figure it out, it is hard coded that red is tex1 and so on. You can’t change it unless you rewrite the shader, it just is like that.

  1. Yellow is a mix of red and green, that is how RGB colors in computers work. See this: http://www.tomjewett.com/colors/rgb.html
  2. I don’t know what you mean, the texture is the actual image that will be painted on the terrain. It will not be “red”, the alpha map is used to select from what image the pixels should be taken from.

So if your alpha map is yellow the shader till take equal parts from the texture1 image and texture2 image and mix together to choose the color of the pixel that is painted on the terrain.

Thanks @jmaasing
This is exactly what i wanted…!