Game Development Community


#1
11/23/2007 (9:55 am)
You can use white/black mask and render (using mask) each texel in temporary variable (register rN), then mix the layers (with lerp for example). It's quite easy.
The same as Blend (or Top-Bottom) material in Studio Max.
#2
11/25/2007 (9:52 pm)
Thanks for your reply.Can you show any example material.I could'nt make out the process you have sent.A brief explantion will be helpfull.

....thanks again
#3
11/26/2007 (5:03 am)
There are examples in \legacyTerrain and \Atlas directories in \shaders, even with lerp.

http://msdn2.microsoft.com/en-us/library/bb509618.aspx

lerp(a, b, s);
Returns a + s(b - a). This linearly interpolates between a and b, such that the return value is a when s is 0, and b when s is 1.

For example if you have 3 textures:grass in S0, rock in S1 and white/black mask in S3, then use in PS:

Fragout main( ConnectData IN,
uniform sampler2D diffuseMap : register(S0),
uniform sampler2D metalMap : register(S1),
uniform sampler2D mask : register(S2)
)
{
Fragout OUT;
//sample
float4 temp1 = tex2D(diffuseMap, IN.texCoord1);
float4 temp2 = tex2D(metalMap, IN.texCoord2);
float4 temp3 = tex2D(mask, IN.texCoord3);

OUT.col = lerp(temp1,temp2,temp3);
//to invert the render ise 1-temp3 as 3th param
return OUT;
}

You can use same Input coords for the three textures if they have the same resolution (for example 256*256). If not you should create new coords for each of them, because the preprocessor texel generation will make artifacts on the final render.
#4
11/27/2007 (1:55 am)
Hi,
Picasso ,I appreciate your effort and explanations.But I am not a coder.Actually I was looking for simple texture blending with multiple ID.We used to do lot in Unreal.


Check this link--
[url]http://phalanx.planetunreal.gamespy.com/tut's/tutorial_sae2.htm[/url]

This link will help you understand that what I want.

Hope Life 'll be easier.

thanks
#5
11/27/2007 (2:33 am)
Just have multiple versions of the polygon at that point and paint a different texture to each one and giving the vertices alpha where you want them to fade / remove them where not visible at all.


Without some modifications to TGEA and a modeller that will create you an opacity map together with the used textures, there is no "vertex paint", TGEA only uses vertex opacity map based blending on the terrains. (if you have those maps then the modification is just something like above in the shader used in a costum material)

At simplest you redirect this hint to your coder teams coder :)
#6
11/27/2007 (3:34 am)
There are a lot of programs like Vertex Painter, Painter3D....., that supports vertex paint.
Use one of them to create the blend mask.
Then use that mask in the shader above.