您的位置:首页 > 电脑网络 > 电脑配件 > Glow Shader With Alpha Support

Glow Shader With Alpha Support

luyued 发布于 2011-04-20 23:16   浏览 N 次  

the shader with alpha support and full model glow:

///////////////////////////////////////////////// //multipass shader for volumetric glow for models ///////////////////////////////////////////////// texture entSkin1; //model skin texture entSkin2;//entskin2 is the glow map.. make it a very dark solid color matrix matWorldViewProj; matrix matWorld; matrix matWorldView; vector vecSkill1; vector vecSkill41; vector vecFog; vector vecSunDir; technique glow { pass p0 { texture[0]=; zWriteEnable=true; alphaBlendEnable=true; vertexShaderConstant[0]=; vertexShaderConstant[4]=; vertexShaderConstant[8]=; vertexShaderConstant[16]=; // shell_distance, 0, fur_u_scale, fur_v_scale vertexShaderConstant[17]={0.0,0.0,0.0,0.0}; // shell_number vertexShaderConstant[19]=; vertexShaderConstant[20]=; vertexShaderConstant[94]=; // first_shell_brightness, brightness_increment, 0, 0 vertexShaderConstant[95]={0.5,1.0,2.0,0.0}; vertexShader = asm { vs.1.1 dcl_position v0 dcl_normal v3 dcl_texcoord1 v7 //color uv mov r0,v0 mov r1,c16 mul r1,r1.x,c17.x // shell distance * shell number mul r1,r1,v3 // scale normal add r0.xyz,r0.xyz,r1.xyz // shell offset (vertex position + scaled normal} m4x4 oPos,r0,c0 // transform position to clip space mov oT0,v7 // output uvs mov r1.w,c20.w // r1.w=1 dp4 r0,v0,c10 // distance to camera position add r0,r0,-c20.x // distance-fog_start mad r0.x,-r0.x,c20.z,r1.w // 1-(distance-fog_start}*(1/(fog_end-fog_start}} max oFog,r0.x,c95.w // clamp with custom max value }; pixelShader= asm { ps.1.1 tex t0 // sample colormap mov r0,t0 }; } //----------------------------------------------------------------------------- pass p1 { texture[0]=; zWriteEnable=true; alphaBlendEnable=true; srcblend=srccolor; destblend=one; vertexShaderConstant[0]=; vertexShaderConstant[4]=; vertexShaderConstant[8]=; vertexShaderConstant[16]=; vertexShaderConstant[17]={1.0,0.0,0.0,0.0}; vertexShaderConstant[19]=; vertexShaderConstant[20]=; vertexShaderConstant[94]=; vertexShaderConstant[95]={0.5,1.0,2.0,0.0}; vertexShader = asm { vs.1.1 dcl_position v0 dcl_normal v3 dcl_texcoord1 v7 //color uv mov r0,v0 mov r1,c16 mul r1,r1.x,c17.x mul r1,r1,v3 add r0.xyz,r0.xyz,r1.xyz m4x4 oPos,r0,c0 mov oT0,v7 mov r1.w,c20.w dp4 r0,v0,c10 add r0,r0,-c20.x mad r0.x,-r0.x,c20.z,r1.w max oFog,r0.x,c95.w }; pixelShader= asm { ps.1.1 tex t0 mov r0,t0 }; } pass p2 { texture[0]=; zWriteEnable=true; alphaBlendEnable=true; vertexShaderConstant[0]=; vertexShaderConstant[4]=; vertexShaderConstant[8]=; vertexShaderConstant[16]=; vertexShaderConstant[17]={2.0,0.0,0.0,0.0}; vertexShaderConstant[19]=; vertexShaderConstant[20]=; vertexShaderConstant[94]=; vertexShaderConstant[95]={0.5,1.0,2.0,0.0}; vertexShader = asm { vs.1.1 dcl_position v0 dcl_normal v3 dcl_texcoord1 v7 //color uv mov r0,v0 mov r1,c16 mul r1,r1.x,c17.x mul r1,r1,v3 add r0.xyz,r0.xyz,r1.xyz m4x4 oPos,r0,c0 mov oT0,v7 mov r1.w,c20.w dp4 r0,v0,c10 add r0,r0,-c20.x mad r0.x,-r0.x,c20.z,r1.w max oFog,r0.x,c95.w }; pixelShader= asm { ps.1.1 tex t0 mov r0,t0 }; } pass p3 { texture[0]=; zWriteEnable=true; alphaBlendEnable=true; vertexShaderConstant[0]=; vertexShaderConstant[4]=; vertexShaderConstant[8]=; vertexShaderConstant[16]=; vertexShaderConstant[17]={3.0,0.0,0.0,0.0}; vertexShaderConstant[19]=; vertexShaderConstant[20]=; vertexShaderConstant[94]=; vertexShaderConstant[95]={0.5,1.0,2.0,0.0}; vertexShader = asm { vs.1.1 dcl_position v0 dcl_normal v3 dcl_texcoord1 v7 //color uv mov r0,v0 mov r1,c16 mul r1,r1.x,c17.x mul r1,r1,v3 add r0.xyz,r0.xyz,r1.xyz m4x4 oPos,r0,c0 mov oT0,v7 mov r1.w,c20.w dp4 r0,v0,c10 add r0,r0,-c20.x mad r0.x,-r0.x,c20.z,r1.w max oFog,r0.x,c95.w }; pixelShader= asm { ps.1.1 tex t0 mov r0,t0 }; } pass p4 { texture[0]=; zWriteEnable=true; alphaBlendEnable=true; vertexShaderConstant[0]=; vertexShaderConstant[4]=; vertexShaderConstant[8]=; vertexShaderConstant[16]=; vertexShaderConstant[17]={4.0,0.0,0.0,0.0}; vertexShaderConstant[19]=; vertexShaderConstant[20]=; vertexShaderConstant[94]=; vertexShaderConstant[95]={0.5,1.0,2.0,0.0}; vertexShader = asm { vs.1.1 dcl_position v0 dcl_normal v3 dcl_texcoord1 v7 //color uv mov r0,v0 mov r1,c16 mul r1,r1.x,c17.x mul r1,r1,v3 add r0.xyz,r0.xyz,r1.xyz m4x4 oPos,r0,c0 mov oT0,v7 mov r1.w,c20.w dp4 r0,v0,c10 add r0,r0,-c20.x mad r0.x,-r0.x,c20.z,r1.w max oFog,r0.x,c95.w }; pixelShader= asm { ps.1.1 tex t0 mov r0,t0 }; } pass p5 { texture[0]=; zWriteEnable=true; alphaBlendEnable=true; vertexShaderConstant[0]=; vertexShaderConstant[4]=; vertexShaderConstant[8]=; vertexShaderConstant[16]=; vertexShaderConstant[17]={5.0,0.0,0.0,0.0}; vertexShaderConstant[19]=; vertexShaderConstant[20]=; vertexShaderConstant[94]=; vertexShaderConstant[95]={0.5,1.0,2.0,0.0}; vertexShader = asm { vs.1.1 dcl_position v0 dcl_normal v3 dcl_texcoord1 v7 //color uv mov r0,v0 mov r1,c16 mul r1,r1.x,c17.x mul r1,r1,v3 add r0.xyz,r0.xyz,r1.xyz m4x4 oPos,r0,c0 mov oT0,v7 mov r1.w,c20.w dp4 r0,v0,c10 add r0,r0,-c20.x mad r0.x,-r0.x,c20.z,r1.w max oFog,r0.x,c95.w }; pixelShader= asm { ps.1.1 tex t0 mov r0,t0 }; } pass p6 { texture[0]=; zWriteEnable=true; alphaBlendEnable=true; vertexShaderConstant[0]=; vertexShaderConstant[4]=; vertexShaderConstant[8]=; vertexShaderConstant[16]=; vertexShaderConstant[17]={6.0,0.0,0.0,0.0}; vertexShaderConstant[19]=; vertexShaderConstant[20]=; vertexShaderConstant[94]=; vertexShaderConstant[95]={0.5,1.0,2.0,0.0}; vertexShader = asm { vs.1.1 dcl_position v0 dcl_normal v3 dcl_texcoord1 v7 //color uv mov r0,v0 mov r1,c16 mul r1,r1.x,c17.x mul r1,r1,v3 add r0.xyz,r0.xyz,r1.xyz m4x4 oPos,r0,c0 mov oT0,v7 mov r1.w,c20.w dp4 r0,v0,c10 add r0,r0,-c20.x mad r0.x,-r0.x,c20.z,r1.w max oFog,r0.x,c95.w }; pixelShader= asm { ps.1.1 tex t0 mov r0,t0 }; } pass p7 { texture[0]=; zWriteEnable=true; alphaBlendEnable=true; vertexShaderConstant[0]=; vertexShaderConstant[4]=; vertexShaderConstant[8]=; vertexShaderConstant[16]=; vertexShaderConstant[17]={7.0,0.0,0.0,0.0}; vertexShaderConstant[19]=; vertexShaderConstant[20]=; vertexShaderConstant[94]=; vertexShaderConstant[95]={0.5,1.0,2.0,0.0}; vertexShader = asm { vs.1.1 dcl_position v0 dcl_normal v3 dcl_texcoord1 v7 //color uv mov r0,v0 mov r1,c16 mul r1,r1.x,c17.x mul r1,r1,v3 add r0.xyz,r0.xyz,r1.xyz m4x4 oPos,r0,c0 mov oT0,v7 mov r1.w,c20.w dp4 r0,v0,c10 add r0,r0,-c20.x mad r0.x,-r0.x,c20.z,r1.w max oFog,r0.x,c95.w }; pixelShader= asm { ps.1.1 tex t0 mov r0,t0 }; } pass p8 { texture[0]=; zWriteEnable=true; alphaBlendEnable=true; vertexShaderConstant[0]=; vertexShaderConstant[4]=; vertexShaderConstant[8]=; vertexShaderConstant[16]=; vertexShaderConstant[17]={8.0,0.0,0.0,0.0}; vertexShaderConstant[19]=; vertexShaderConstant[20]=; vertexShaderConstant[94]=; vertexShaderConstant[95]={0.5,1.0,2.0,0.0}; vertexShader = asm { vs.1.1 dcl_position v0 dcl_normal v3 dcl_texcoord1 v7 //color uv mov r0,v0 mov r1,c16 mul r1,r1.x,c17.x mul r1,r1,v3 add r0.xyz,r0.xyz,r1.xyz m4x4 oPos,r0,c0 mov oT0,v7 mov r1.w,c20.w dp4 r0,v0,c10 add r0,r0,-c20.x mad r0.x,-r0.x,c20.z,r1.w max oFog,r0.x,c95.w }; pixelShader= asm { ps.1.1 tex t0 mov r0,t0 }; } pass p9 { texture[0]=; zWriteEnable=true; alphaBlendEnable=true; vertexShaderConstant[0]=; vertexShaderConstant[4]=; vertexShaderConstant[8]=; vertexShaderConstant[16]=; vertexShaderConstant[17]={9.0,0.0,0.0,0.0}; vertexShaderConstant[19]=; vertexShaderConstant[20]=; vertexShaderConstant[94]=; vertexShaderConstant[95]={0.5,1.0,2.0,0.0}; vertexShader = asm { vs.1.1 dcl_position v0 dcl_normal v3 dcl_texcoord1 v7 //color uv mov r0,v0 mov r1,c16 mul r1,r1.x,c17.x mul r1,r1,v3 add r0.xyz,r0.xyz,r1.xyz m4x4 oPos,r0,c0 mov oT0,v7 mov r1.w,c20.w dp4 r0,v0,c10 add r0,r0,-c20.x mad r0.x,-r0.x,c20.z,r1.w max oFog,r0.x,c95.w }; pixelShader= asm { ps.1.1 tex t0 mov r0,t0 }; } pass p10 { texture[0]=; zWriteEnable=true; alphaBlendEnable=true; vertexShaderConstant[0]=; vertexShaderConstant[4]=; vertexShaderConstant[8]=; vertexShaderConstant[16]=; vertexShaderConstant[17]={10.0,0.0,0.0,0.0}; vertexShaderConstant[19]=; vertexShaderConstant[20]=; vertexShaderConstant[94]=; vertexShaderConstant[95]={0.5,1.0,2.0,0.0} 
			
图文资讯
广告赞助商