I am making a simple effect, a texture is on top of other texture/shader and blending in with them multiply mode.
I have tried by fail .. Could anyone have done it please help. I have try to find in the manual but the effect manual is too bad!
My code
Code:
bmap bcube=<cube+6.tga>;
function mtl_envmap_view()
{
mat_set(mtl.matrix,matViewInv);
mtl.matrix41=0;
mtl.matrix42=0;
mtl.matrix43=0;
}
function mtl_envmap_init()
{
bmap_to_cubemap(mtl.skin1);
mtl.event=mtl_envmap_view;
mtl.enable_view=on;
}
material mtl_envmap
{
skin1=bcube;
event=mtl_envmap_init;
effect=
"
texture entSkin1;
texture mtlSkin1;
matrix matMtl;
technique envmap
{
pass p0
{
Texture[0] = <entSkin1>;
ColorArg1[0] = Texture; // stage 0 = skin texture
ColorOp[0] = Modulate2x;
ColorArg2[0] = Diffuse; // modulate by lighting
}
pass p1
{
texture[0]=<entSkin1>;
texture[1]=<mtlSkin1>;
zWriteEnable=true;
alphaBlendEnable=false;
colorArg1[0]=Texture;
colorOp[0]=Modulate2x;
colorArg2[0]=Diffuse;
colorArg1[1]=Texture;
colorOp[1]=blendCurrentAlpha;
addressU[1]=Clamp;
addressV[1]=Clamp;
texCoordIndex[1]=cameraSpaceReflectionVector;
textureTransformFlags[1]=Count3;
textureTransform[1]=<matMtl>; // transform camera space back to world space
}
}
";
}
This is the code of an enviroment cube map.. Now, I want to make a texture blend over the shader. I think I must write a new pass, blend with the existing pass, but do not know how to do ?