Here is the (2) texture version of the old code redone.
BTW: If you want to utilize HLSL, for more flexibility, then you can
modify code in
this thread here. Code:
///////////////////////////////////////////////////////////
// FFP Terrain MultiTexturing Effect
//
// Blending (2) Textures
//
// By: Eric A. Hendrickson-Lambert (Steempipe)
//
//
// 1/6/05: Update original code for MK_1
// to build with A6.31.4 & DX9.00c
//
//////////////////////////////////////////////////////////
//*****************************************************
//** I had strange results with putting the alphamaps
//** in to the HMP as entSkins.
//** Just load them as mtlSkins.
//*****************************************************
// RGB Channels are blank
// The A channel has the blending weight (pattern)
bmap blendmap = <blendmap.tga>; // Blender for Pass p1
//*****************************************************
//** entSkins 1-4 are tilable textures
//** Be sure to add mipmaps to them in MED
//*****************************************************
var Detail_Size = 0;
function mtl_terraintex_init()
{
bmap_to_mipmap(mtl.skin1);
//
// Adjust the texture transform to do some tiling of the textures
//
mtl.matrix11 = float(28); // default u scale
mtl.matrix22 = float(28); // default v scale
}
///////////////////////////////////////////////////////////////////////
//The Material
///////////////////////////////////////////////////////////////////////
material mat_terraintex
{
skin1 = blendmap;
// define a material effect string
event = mtl_terraintex_init;
effect =
"
matrix matMtl;
texture mtlSkin1; // Blending map for Pass P1
texture entSkin1; // Tileable Tex
texture entSkin2; // Tileable Tex
///////////////////////////////////////////////////////////////////////
//The Technique
///////////////////////////////////////////////////////////////////////
technique ffp_terrain_tex
{
pass P0
//////////////////////////////////////////////////////
//// Lets lay the first texture down. no alpha work
//////////////////////////////////////////////////////
{
AlphaBlendEnable=False;
AlphaTestEnable=False;
Lighting = True;
zEnable=True;
zWriteEnable=True;
////////////////////////////////////////
// Stage 0
///////////////////////////////////////
Texture[0] = <entSkin1>;
magFilter[0]=linear;
minFilter[0]=linear;
mipFilter[0]=linear;
TextureTransformFlags[0] = Count2;
TextureTransform[0] = <matMtl>;
texcoordindex[0]=1;
ColorArg1[0] = Texture;
ColorOp[0] = Modulate;
ColorArg2[0] = Diffuse;
AlphaOp[0]=Disable;
//////////////////////////////////////
//stage 1
//////////////////////////////////////
ColorOp[1]=Disable;
AlphaOp[1]=Disable;
}
pass P1
//////////////////////////////////////////////////////
//// Now we blend another texture using an alphamap
//////////////////////////////////////////////////////
{
//////////////////////////////////////
// Stage 0
//////////////////////////////////////
// We need to enable alphablending
AlphaBlendEnable=True;
SrcBlend=SrcAlpha;
DestBlend=InvSrcAlpha;
zEnable=False;
zWriteEnable=False;
Texture[0] = <mtlSkin1>;
magFilter[0]=Linear;
minFilter[0]=Linear;
mipFilter[0]=Linear;
//
// We don't want the alphamap to tile
//
TextureTransformFlags[0] = disable;
TexCoordIndex[0]=0;
ColorArg1[0] = Current;
ColorOp[0] = SelectArg1;
AlphaArg1[0] = Texture;
AlphaOp[0]=SelectArg1;
//////////////////////////////////////////////
// Stage 1
//////////////////////////////////////////////
Texture[1] = <entSkin2>;
zEnable=True;
zWriteEnable=True;
magFilter[1]=Linear;
minFilter[1]=Linear;
mipFilter[1]=Linear;
TextureTransformFlags[1] = Count2;
TextureTransform[1] = <matMtl>;
TexCoordIndex[1]=1;
ColorArg1[1] = Texture;
ColorOp[1] = Modulate;
AlphaArg1[1] = Current;
AlphaOp[1]=Disable;
///////////////////////////////////////////////
// Stage 2
///////////////////////////////////////////////
ColorOp[2]=Disable;
AlphaOp[2]=Disable;
}
} // End of Technique
"; // end of the effect string
} // End of Material
///////////////////////////////////////////////////////////////////////
//The Action we assign in WED
///////////////////////////////////////////////////////////////////////
action ffp_TerrainTex
{
my.transparent=off;
my.material = mat_terraintex;
}