Add new color in terrain alphamap

Hi,
I’m using the sample Terrain.j3md and it has three color: red, green and blue.
I would like to add more color (black and white) to add mpre textures.

I changed the files and added:
terrain.j3md:


Texture2D Tex4
Float Tex4Scale

terrain.frag:


....
uniform float m_Tex4Scale;
...
col1 = texture2D( m_Tex4, coords.yz * m_Tex4Scale );
col2 = texture2D( m_Tex4, coords.xz * m_Tex4Scale );
col3 = texture2D( m_Tex4, coords.xy * m_Tex4Scale );
// blend the results of the 3 planar projections.
vec4 tex4 = col1 * blending.x + col2 * blending.y + col3 * blending.z;

but dont work on:


vec4 color = vec4(1.0, 1.0, 1.0, 1.0);
outColor = mix( outColor, tex4, myWhiteColor); // white channel

I add color white in png file.
how i add new color texture ?

Thanks

Let’s do a thought experiment. Say you store multiple values in a color component. One value in red, one in blue, and one in green (and you can have another in alpha). Each of these work independently.

Now, how would you add “more values” in such a way that does not affect the other four?

Hint: impossible

You would have to modify the shader to support an additional color layer for four additional channels.

See this map:

this is jmonkey.

This image Have a red color, blue color and green color.
i made a white color risk and i like texturing in white risk.

@sradkiller said: This image Have a red color, blue color and green color. i made a white color risk and i like texturing in white risk.

Thought experiment: How can you set a color to white without changing its red, green, or blue values? (You can’t.)

Actually, I don’t know what “white risk” means so maybe I don’t understand you.

I just want to add a white color on the map for me texturing.

@sradkiller said: I just want to add a white color on the map for me texturing.

There is only so many ways to say “you can’t”. They aren’t colors. Red = layer1, green = layer2, and blue = layer3. So white = layer1layer2layer3.

Ok… but, how i use “layer1layer2layer3.” ?

I got…
outColor = mix( outColor, tex4, alpha.ralpha.galpha.b);
and other colors ?
like RGB (100, 50, 200)
?

I think you aren’t understanding.

red = how much of layer 1 to mix in.

green = how much of layer 2 to mix in.

blue = how much of layer 3 to mix in.

These are separate values. The color white is red =1, green =1, blue =1… so trying to use white as a layer WILL NOT WORK… because it is SETTING ALL OF THE LAYERS TO 1.

thank you.