From GameStudio Wiki
technique SimpleGlass{
pass p0{
AlphaBlendEnable=True;
Zenable = True;
AlphaTestEnable=True;
ZwriteEnable = False;
// ZwriteEnable = True;
CULLMODE = CCW;
BlendOp=5;
texture~[0]=<mtlSkin1>;
vertexShaderConstant~[0]=<matWorldViewProj>;
vertexShaderConstant~[4]=<matWorld>;
vertexShaderConstant~[7]=<vecViewPos>;
vertexShaderConstant~[9]= <vecFog>;//Lion
vertexShaderConstant~[12]={0.5,1.0,2.0,0.0};
vertexShaderConstant~[16]=<matWorldView>;
vertexShader =
asm{
vs.1.1
dcl_position v0
dcl_normal v3
dp3 r0.x, v3, c4
dp3 r0.y, v3, c5
dp3 r0.z, v3, c6
dp3 r1.x, r0, r0
rsq r0.w, r1.x
dp4 r1.x, v0, c4
dp4 r1.y, v0, c5
dp4 r1.z, v0, c6
mul r0.xyz, r0, r0.w
add r1.xyz, r1, -c7
dp3 r2.x, r1, r0
add r0.w, r2.x, r2.x
mad oT0.xyz, r0, -r0.w, r1
// Fog calculations
mov r1.w,c9.w
dp4 r0,v0,c18 // distance to camera position
add r0,r0,-c9.x // distance-fog_start
mad r0.x,-r0.x,c9.z,r1.w // 1-(distance-fog_start)*(1/(fog_end-fog_start))
max oFog,r0.x,c12.w // clamp with custom max value
// Pass the texture coordinates through
dp4 oPos.x, v0, c0
dp4 oPos.y, v0, c1
dp4 oPos.z, v0, c2
dp4 oPos.w, v0, c3
};
pixelShader=
asm{
ps.1.1
tex t0
mov r0, t0
};
}
}