Does anybody know how i could get this cube map to have alpha transparency so that i can still see the surface that it is masked over?
/////
//// A6 Shader , Developed By Unknot
/// For ice floor, or Wet paviments
/// Use a terrain with skin1 base map with alpha map
bmap bmp_envplane = <sky+6.tga>; //cube image
function mtl_envplane()
{
mat_set(mtl.matrix,matViewInv);
mtl.matrix41=0;
mtl.matrix42=0;
mtl.matrix43=0;
}
function mtl_envplane_ini()
{
//...maybe you should copy the mat_model properties here...
bmap_to_cubemap(mtl.skin1);
mtl.event=mtl_envplane;
mtl.enable_view=on;
}
material mtl_envcube2plane // environment cube
{
skin1 = bmp_envplane; //cube plane
event = mtl_envplane_ini;
effect=
"
texture mtlSkin1;
texture entSkin1;
matrix matMtl;
technique cubic_environment
{
pass p0
{
Texture[1]=<mtlSkin1>;
zWriteEnable=true;
alphaBlendEnable=false;
//colorArg1[1]=diffuse;
//colorArg1[1]=texture;
colorOp[1]=blendCurrentAlpha;
addressU[1]=Clamp;
addressV[1]=Clamp;
TextureTransformFlags[1] =count3 ;
texcoordindex[1]= cameraspaceposition ; // For cubemap use: cameraspacereflectionvector
//texcoordindex[1]= cameraspacereflectionvector | 1; // For cubemap use: cameraspacereflectionvector
TextureTransform[1]=<matMtl>;
}
}
";
}
action shaders_plane
{
my.material = mtl_envcube2plane;
}
//////////////////////////////////////////////////////////////////
//
// Use alpha transparency with Envmap
//
//
// By: Eric Hendrickson-Lambert (Steempipe)
//
// If it whacks you computer.... Sorry.
//
// 8-30-04: Updated to help ensure it runs on geforce2(?)
//
//bmap transenvmap_cube= <desertsm+6.tga>; // CubicEnvMap
function transenv_view()
{
mat_set(mtl.matrix,matViewInv);
mtl.matrix41=0;
mtl.matrix42=0;
mtl.matrix43=0;
}
function transenv_init()
{
// Best to approach mipmapping this way with cubemap, I think.
bmap_to_cubemap(bmap_to_mipmap(mtl.skin1));
mtl.event=transenv_view;
mtl.enable_view=on;
}
material transenv
{
skin1=bmp_envplane;
event=transenv_init;
effect=
"
texture mtlSkin1;
matrix matMtl;
vector vecAmbient; //<<---------
vector vecSpecular; //<<---------
vector vecDiffuse; //<<---------
vector vecEmissive; //<<---------
Technique envmap
{
Pass p0
{
Texture[0]=<mtlSkin1>;
AddressU[0]=Clamp;
AddressV[0]=Clamp;
MagFilter[0]=Linear;
MinFilter[0]=Linear;
MipFilter[0]=Linear;
///////////////////////////////////
// Never trust any card's defaults
AlphaBlendEnable=True;
Zenable = True;
ZwriteEnable = True;
SrcBlend=srcAlpha; //<<---------
DestBlend=InvSrcAlpha; //<<---------
BlendOp=Add; //<<---------
Lighting=True; //<<---------
AmbientMaterialSource=<vecAmbient>; //<<---------
DiffuseMaterialSource=<vecDiffuse>; //<<---------
SpecularMaterialSource=<vecSpecular>; //<<---------
EmissiveMaterialSource=<vecEmissive>; //<<---------
//////////////////////////////////
TexCoordIndex[0]=CameraSpaceReflectionVector;
TextureTransformFlags[0]=Count3;
TextureTransform[0]=<matMtl>;
ColorArg1[0]=Texture;
ColorOp[0]=SelectArg1;
Alphaop[0]=SelectArg1; //<<---------
AlphaArg1[0]=Diffuse; //<<---------
ColorOp[1]=Disable;
AlphaOp[1]=Disable;
}
}
";
}
action ffp_TransEnvMap
{
my.transparent=on;
my.alpha=60;
my.material = transenv;
}