// Pirates Blue Shader // Casey O'Toole, Firaxis Games, 2004 // // GLOBALS float fLightRange : GLOBAL; float3 f3LightPos1 : GLOBAL; float3 f3LightPos2 : GLOBAL; float3 f3LightPos3 : GLOBAL; float3 f3LightPos4 : GLOBAL; float3 f3LightPos5 : GLOBAL; float3 f3LightPos6 : GLOBAL; float3 f3LightPos7 : GLOBAL; float3 f3LightPos8 : GLOBAL; float3 f3DirLight : GLOBAL; float3 f3ViewPos : GLOBAL; float4 f3BackgroundColor : GLOBAL; float3x3 mtxLightRot1 : GLOBAL; float3x3 mtxLightRot2 : GLOBAL; float3x3 mtxLightRot3 : GLOBAL; float3x3 mtxLightRot4 : GLOBAL; float3x3 mtxLightRot5 : GLOBAL; float3x3 mtxLightRot6 : GLOBAL; float3x3 mtxLightRot7 : GLOBAL; float3x3 mtxLightRot8 : GLOBAL; // texture texture Tex0 < string NTM = "base"; >; texture NormalMap < string NTM = "shader"; int NTMIndex = 0; >; texture AttenuationXYMap < string name = "assets\\Texture-PC\\AttenuationXY.dds"; >; sampler AttenuationXYSampler = sampler_state { Texture = (AttenuationXYMap); MagFilter = LINEAR; MinFilter = LINEAR; AddressU = CLAMP; AddressV = CLAMP; }; sampler NormalSampler = sampler_state { Texture = (NormalMap); MagFilter = LINEAR; MinFilter = LINEAR; MipFilter = LINEAR; AddressU = WRAP; AddressV = WRAP; }; sampler Sampler = sampler_state { Texture = (Tex0); MipFilter = LINEAR; MinFilter = LINEAR; MagFilter = LINEAR; AddressU = WRAP; AddressV = WRAP; }; //------------------------------------------------------------------------------------------------ // FUNCTIONS //------------------------------------------------------------------------------------------------ // Bias the vector to a (0,1) range float3 bias( float3 f3Unbiased ) { return (0.5f * f3Unbiased) + 0.5f; } float3 unbias( float3 f3Unbiased ) { return 2.0f * (f3Unbiased - 0.5f); } // transformations float4x4 World : WORLD; float4x4 InvWorld : INVWORLD; float4x4 WorldView : WORLDVIEW; float4x4 WorldViewProj : WORLDVIEWPROJ; struct VS_OUTPUT_ATT { float4 f4Pos : POSITION; float2 f2TexCoords1 : TEXCOORD0; float2 f2TexCoords2 : TEXCOORD1; float2 f2NormalTex : TEXCOORD2; float3 f3Light : TEXCOORD3; }; struct VS_OUTPUT_ZFILL_AND_DIR { float4 f4Pos : POSITION; float2 f2TexCoords1 : TEXCOORD0; float2 f2NormalTex : TEXCOORD1; float3 f3Light : TEXCOORD2; }; struct VS_OUTPUT_BASE { float4 f4Pos : POSITION; float2 f2TexCoords1 : TEXCOORD0; }; //$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ // VERTEX SHADER //$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ VS_OUTPUT_BASE VS_Blue_Base_1_1( float3 InPos : POSITION, float3 Norm : NORMAL, float3 f3InBiNormal: BINORMAL, float3 f3InTangent : TANGENT, float2 f2Tex : TEXCOORD) { VS_OUTPUT_BASE Out; // Transform the vertex into screen space Out.f4Pos = mul( float4( InPos, 1 ), WorldViewProj ); // Base tex coords Out.f2TexCoords1 = f2Tex; return Out; } VS_OUTPUT_ZFILL_AND_DIR VS_Blue_ZFill_And_Dir_1_1( float3 InPos : POSITION, float3 Norm : NORMAL, float3 f3InBiNormal: BINORMAL, float3 f3InTangent : TANGENT, float2 f2Tex : TEXCOORD) { VS_OUTPUT_ZFILL_AND_DIR Out; // Transform the vertex into screen space Out.f4Pos = mul( float4( InPos, 1 ), WorldViewProj ); // Get model-space light position float3 MSLightPos = mul(float4(f3DirLight, 1), InvWorld); // Get model-space light direction float3 MSLightDir = MSLightPos - InPos; // Get model-space light direction //float3 MSLightDir = mul(float4(f3DirLight, 1), InvWorld); // Transform into tangent-space light direction float fX = dot(f3InTangent, MSLightDir); float fY = dot(f3InBiNormal, MSLightDir); float fZ = dot(Norm, MSLightDir); Out.f3Light = normalize(float3(fX, fY, fZ)); // Base tex coords Out.f2TexCoords1 = f2Tex; Out.f2NormalTex = f2Tex; return Out; } //$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ // VERTEX SHADER //$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ VS_OUTPUT_ATT VS_Blue_Att_1_1( float3 InPos : POSITION, float3 Norm : NORMAL, float3 f3InBiNormal: BINORMAL, float3 f3InTangent : TANGENT, float2 f2Tex : TEXCOORD, uniform float3 f3LightPos, uniform float3x3 mtxLightRot ) { VS_OUTPUT_ATT Out = (VS_OUTPUT_ATT)0; float3 f3Attenuation; // Transform the vertex into screen space Out.f4Pos = mul( float4( InPos, 1 ), WorldViewProj ); // Transform the vertex into world space float3 f3Pos = mul( float4( InPos, 1 ), World ); // Compute our attenuation f3Attenuation = (f3LightPos - f3Pos) * fLightRange; f3Attenuation = bias( mul(f3Attenuation,mtxLightRot) ); // Get model-space light position float3 MSLightPos = mul(float4(f3LightPos, 1), InvWorld); // Get model-space light direction float3 MSLightDir = MSLightPos - InPos; // Transform into tangent-space light direction float fX = dot(f3InTangent, MSLightDir); float fY = dot(f3InBiNormal, MSLightDir); float fZ = dot(Norm, MSLightDir); Out.f3Light = normalize(float3(fX, fY, fZ)); // The attenuation coords Out.f2TexCoords1.xy = f3Attenuation.xy; Out.f2TexCoords2.x = f3Attenuation.z; Out.f2TexCoords2.y = 0.5f; // Normal Map and Base tex coords Out.f2NormalTex = f2Tex; return Out; } // Normal Mapping and Attenuation Shader float4 PS_Blue_Intensity_1_1( float2 XYAttTex : TEXCOORD0, float2 ZAttTex : TEXCOORD1, float2 f2NormalTex : TEXCOORD2, float3 f3Light : TEXCOORD3) : COLOR { float4 XYAtt = tex2D(AttenuationXYSampler, XYAttTex); float4 ZAtt = tex2D(AttenuationXYSampler, ZAttTex); float4 NormMap = tex2D(NormalSampler, f2NormalTex); float3 Normal = NormMap * 2.0f - 1.0f; float LightIntensity = dot(Normal, f3Light)*2; float4 TotalAtt = (XYAtt*ZAtt); float4 Final; Final.xyzw = TotalAtt*LightIntensity; return Final; } // Directional light float4 PS_Blue_Dir_1_1( float2 f2TexCoords1 : TEXCOORD0, float2 f2NormalTex : TEXCOORD1, float3 f3Light : TEXCOORD2) : COLOR { float4 TexMap = tex2D(Sampler, f2TexCoords1); float4 NormMap = tex2D(NormalSampler, f2NormalTex); float3 Normal = NormMap * 2.0f - 1.0f; float LightIntensity = dot(Normal, f3Light)*0.6f + 0.25; float4 Final; //Final.xyzw = LightIntensity + (1-LightIntensity)*f3BackgroundColor; Final.xy = LightIntensity*0.15f; Final.z = LightIntensity; Final.w = TexMap.w; return Final; } // Probably shouldn't even do a shader for this part? float4 PS_Blue_BaseMult_1_1( float2 Tex : TEXCOORD0) : COLOR { float4 Base = tex2D(Sampler, Tex); return Base; } technique FillZBuffer { pass p0 { // Allow the use of multiple texcoord indices TexCoordIndex[0] = 0; TexCoordIndex[1] = 1; Sampler[0] = ; Sampler[1] = ; // Enable depth writing ZEnable = TRUE; ZWriteEnable = TRUE; ZFunc = LESS; // Enable alpha blending, multiply 2nd pass result by attenuation ramp in Frame Buffer alpha AlphaTestEnable = TRUE; AlphaRef = 0; AlphaFunc = NOTEQUAL; AlphaBlendEnable = TRUE; SrcBlend = SRCALPHA; DestBlend = INVSRCALPHA; // Write to no channels ColorWriteEnable = 0xF; TEXTURETRANSFORMFLAGS[0] = 0; // shaders VertexShader = compile vs_1_1 VS_Blue_Base_1_1(); PixelShader = compile ps_1_1 PS_Blue_Dir_1_1(); } } technique Blue_OneLight_1_1 { pass P0 { // Allow the use of multiple texcoord indices TexCoordIndex[0] = 0; TexCoordIndex[1] = 1; TexCoordIndex[2] = 2; TexCoordIndex[3] = 3; // Set the samplers Sampler[0] = ; Sampler[1] = ; // Enable depth writing ZEnable = TRUE; ZWriteEnable = TRUE; ZFunc = EQUAL; AlphaRef = 0; AlphaFunc = NOTEQUAL; AlphaTestEnable = FALSE; AlphaBlendEnable = TRUE; SrcBlend = ONE; DestBlend = ONE; // Write to frame buffer's alpha channel only ColorWriteEnable = 0xF; TEXTURETRANSFORMFLAGS[0] = 0; // shaders VertexShader = compile vs_1_1 VS_Blue_Att_1_1(f3LightPos1, mtxLightRot1); PixelShader = compile ps_1_1 PS_Blue_Intensity_1_1(); } pass P1 { // Set the samplers Sampler[0] = ; // Enable alpha blending, multiply 2nd pass result by attenuation ramp in Frame Buffer alpha AlphaTestEnable = FALSE; AlphaBlendEnable = TRUE; SrcBlend = DESTCOLOR; DestBlend = ZERO; // Write to all channels ColorWriteEnable = 0xF; // shaders VertexShader = compile vs_1_1 VS_Blue_Base_1_1(); PixelShader = compile ps_1_1 PS_Blue_BaseMult_1_1(); } } technique Blue_TwoLight_1_1 { pass P0 { // Allow the use of multiple texcoord indices TexCoordIndex[0] = 0; TexCoordIndex[1] = 1; TexCoordIndex[2] = 2; TexCoordIndex[3] = 3; // Set the samplers Sampler[0] = ; Sampler[1] = ; // Enable depth writing ZEnable = TRUE; ZWriteEnable = TRUE; ZFunc = EQUAL; AlphaTestEnable = FALSE; AlphaBlendEnable = TRUE; SrcBlend = ONE; DestBlend = ONE; // Write to frame buffer's alpha channel only ColorWriteEnable = 0xF; // shaders VertexShader = compile vs_1_1 VS_Blue_Att_1_1(f3LightPos1, mtxLightRot1); PixelShader = compile ps_1_1 PS_Blue_Intensity_1_1(); } pass P1 { // Set the samplers Sampler[0] = ; Sampler[1] = ; // shaders VertexShader = compile vs_1_1 VS_Blue_Att_1_1(f3LightPos2, mtxLightRot2); PixelShader = compile ps_1_1 PS_Blue_Intensity_1_1(); } pass P2 { // Set the samplers Sampler[0] = ; // Enable alpha blending, multiply 2nd pass result by attenuation ramp in Frame Buffer alpha AlphaTestEnable = FALSE; AlphaBlendEnable = TRUE; SrcBlend = DESTCOLOR; DestBlend = ZERO; // Write to all channels ColorWriteEnable = 0xF; // shaders VertexShader = compile vs_1_1 VS_Blue_Base_1_1(); PixelShader = compile ps_1_1 PS_Blue_BaseMult_1_1(); } } technique Blue_ThreeLight_1_1 { pass P0 { // Allow the use of multiple texcoord indices TexCoordIndex[0] = 0; TexCoordIndex[1] = 1; TexCoordIndex[2] = 2; TexCoordIndex[3] = 3; // Set the samplers Sampler[0] = ; Sampler[1] = ; // Enable depth writing ZEnable = TRUE; ZWriteEnable = TRUE; ZFunc = EQUAL; AlphaTestEnable = FALSE; AlphaBlendEnable = TRUE; SrcBlend = ONE; DestBlend = ONE; // Write to frame buffer's alpha channel only ColorWriteEnable = 0xF; // shaders VertexShader = compile vs_1_1 VS_Blue_Att_1_1(f3LightPos1, mtxLightRot1); PixelShader = compile ps_1_1 PS_Blue_Intensity_1_1(); } pass P1 { // Set the samplers Sampler[0] = ; Sampler[1] = ; // shaders VertexShader = compile vs_1_1 VS_Blue_Att_1_1(f3LightPos2, mtxLightRot2); PixelShader = compile ps_1_1 PS_Blue_Intensity_1_1(); } pass P2 { // Set the samplers Sampler[0] = ; Sampler[1] = ; // shaders VertexShader = compile vs_1_1 VS_Blue_Att_1_1(f3LightPos3, mtxLightRot3); PixelShader = compile ps_1_1 PS_Blue_Intensity_1_1(); } pass P3 { // Set the samplers Sampler[0] = ; // Enable alpha blending, multiply 2nd pass result by attenuation ramp in Frame Buffer alpha AlphaTestEnable = FALSE; AlphaBlendEnable = TRUE; SrcBlend = DESTCOLOR; DestBlend = ZERO; // Write to all channels ColorWriteEnable = 0xF; // shaders VertexShader = compile vs_1_1 VS_Blue_Base_1_1(); PixelShader = compile ps_1_1 PS_Blue_BaseMult_1_1(); } } technique Blue_FourLight_1_1 { pass P0 { // Allow the use of multiple texcoord indices TexCoordIndex[0] = 0; TexCoordIndex[1] = 1; TexCoordIndex[2] = 2; TexCoordIndex[3] = 3; // Set the samplers Sampler[0] = ; Sampler[1] = ; // Enable depth writing ZEnable = TRUE; ZWriteEnable = TRUE; ZFunc = EQUAL; AlphaTestEnable = FALSE; AlphaBlendEnable = TRUE; SrcBlend = ONE; DestBlend = ONE; // Write to frame buffer's alpha channel only ColorWriteEnable = 0xF; // shaders VertexShader = compile vs_1_1 VS_Blue_Att_1_1(f3LightPos1, mtxLightRot1); PixelShader = compile ps_1_1 PS_Blue_Intensity_1_1(); } pass P1 { // Set the samplers Sampler[0] = ; Sampler[1] = ; // shaders VertexShader = compile vs_1_1 VS_Blue_Att_1_1(f3LightPos2, mtxLightRot2); PixelShader = compile ps_1_1 PS_Blue_Intensity_1_1(); } pass P2 { // Set the samplers Sampler[0] = ; Sampler[1] = ; // shaders VertexShader = compile vs_1_1 VS_Blue_Att_1_1(f3LightPos3, mtxLightRot3); PixelShader = compile ps_1_1 PS_Blue_Intensity_1_1(); } pass P3 { // Set the samplers Sampler[0] = ; Sampler[1] = ; // shaders VertexShader = compile vs_1_1 VS_Blue_Att_1_1(f3LightPos4, mtxLightRot4); PixelShader = compile ps_1_1 PS_Blue_Intensity_1_1(); } pass P4 { // Set the samplers Sampler[0] = ; // Enable alpha blending, multiply 2nd pass result by attenuation ramp in Frame Buffer alpha AlphaTestEnable = FALSE; AlphaBlendEnable = TRUE; SrcBlend = DESTCOLOR; DestBlend = ZERO; // Write to all channels ColorWriteEnable = 0xF; // shaders VertexShader = compile vs_1_1 VS_Blue_Base_1_1(); PixelShader = compile ps_1_1 PS_Blue_BaseMult_1_1(); } } technique Blue_FiveLight_1_1 { pass P0 { // Allow the use of multiple texcoord indices TexCoordIndex[0] = 0; TexCoordIndex[1] = 1; TexCoordIndex[2] = 2; TexCoordIndex[3] = 3; // Set the samplers Sampler[0] = ; Sampler[1] = ; // Enable depth writing ZEnable = TRUE; ZWriteEnable = TRUE; ZFunc = EQUAL; AlphaTestEnable = FALSE; AlphaBlendEnable = TRUE; SrcBlend = ONE; DestBlend = ONE; // Write to frame buffer's alpha channel only ColorWriteEnable = 0xF; // shaders VertexShader = compile vs_1_1 VS_Blue_Att_1_1(f3LightPos1, mtxLightRot1); PixelShader = compile ps_1_1 PS_Blue_Intensity_1_1(); } pass P1 { // Set the samplers Sampler[0] = ; Sampler[1] = ; // shaders VertexShader = compile vs_1_1 VS_Blue_Att_1_1(f3LightPos2, mtxLightRot2); PixelShader = compile ps_1_1 PS_Blue_Intensity_1_1(); } pass P2 { // Set the samplers Sampler[0] = ; Sampler[1] = ; // shaders VertexShader = compile vs_1_1 VS_Blue_Att_1_1(f3LightPos3, mtxLightRot3); PixelShader = compile ps_1_1 PS_Blue_Intensity_1_1(); } pass P3 { // Set the samplers Sampler[0] = ; Sampler[1] = ; // shaders VertexShader = compile vs_1_1 VS_Blue_Att_1_1(f3LightPos4, mtxLightRot4); PixelShader = compile ps_1_1 PS_Blue_Intensity_1_1(); } pass P4 { // Set the samplers Sampler[0] = ; Sampler[1] = ; // shaders VertexShader = compile vs_1_1 VS_Blue_Att_1_1(f3LightPos5, mtxLightRot5); PixelShader = compile ps_1_1 PS_Blue_Intensity_1_1(); } pass P5 { // Set the samplers Sampler[0] = ; // Enable alpha blending, multiply 2nd pass result by attenuation ramp in Frame Buffer alpha AlphaTestEnable = FALSE; AlphaBlendEnable = TRUE; SrcBlend = DESTCOLOR; DestBlend = ZERO; // Write to all channels ColorWriteEnable = 0xF; // shaders VertexShader = compile vs_1_1 VS_Blue_Base_1_1(); PixelShader = compile ps_1_1 PS_Blue_BaseMult_1_1(); } } technique Blue_SixLight_1_1 { pass P0 { // Allow the use of multiple texcoord indices TexCoordIndex[0] = 0; TexCoordIndex[1] = 1; TexCoordIndex[2] = 2; TexCoordIndex[3] = 3; // Set the samplers Sampler[0] = ; Sampler[1] = ; // Enable depth writing ZEnable = TRUE; ZWriteEnable = TRUE; ZFunc = EQUAL; AlphaTestEnable = FALSE; AlphaBlendEnable = TRUE; SrcBlend = ONE; DestBlend = ONE; // Write to frame buffer's alpha channel only ColorWriteEnable = 0xF; // shaders VertexShader = compile vs_1_1 VS_Blue_Att_1_1(f3LightPos1, mtxLightRot1); PixelShader = compile ps_1_1 PS_Blue_Intensity_1_1(); } pass P1 { // Set the samplers Sampler[0] = ; Sampler[1] = ; // shaders VertexShader = compile vs_1_1 VS_Blue_Att_1_1(f3LightPos2, mtxLightRot2); PixelShader = compile ps_1_1 PS_Blue_Intensity_1_1(); } pass P2 { // Set the samplers Sampler[0] = ; Sampler[1] = ; // shaders VertexShader = compile vs_1_1 VS_Blue_Att_1_1(f3LightPos3, mtxLightRot3); PixelShader = compile ps_1_1 PS_Blue_Intensity_1_1(); } pass P3 { // Set the samplers Sampler[0] = ; Sampler[1] = ; // shaders VertexShader = compile vs_1_1 VS_Blue_Att_1_1(f3LightPos4, mtxLightRot4); PixelShader = compile ps_1_1 PS_Blue_Intensity_1_1(); } pass P4 { // Set the samplers Sampler[0] = ; Sampler[1] = ; // shaders VertexShader = compile vs_1_1 VS_Blue_Att_1_1(f3LightPos5, mtxLightRot5); PixelShader = compile ps_1_1 PS_Blue_Intensity_1_1(); } pass P5 { // Set the samplers Sampler[0] = ; Sampler[1] = ; // shaders VertexShader = compile vs_1_1 VS_Blue_Att_1_1(f3LightPos6, mtxLightRot6); PixelShader = compile ps_1_1 PS_Blue_Intensity_1_1(); } pass P6 { // Set the samplers Sampler[0] = ; // Enable alpha blending, multiply 2nd pass result by attenuation ramp in Frame Buffer alpha AlphaTestEnable = FALSE; AlphaBlendEnable = TRUE; SrcBlend = DESTCOLOR; DestBlend = ZERO; // Write to all channels ColorWriteEnable = 0xF; // shaders VertexShader = compile vs_1_1 VS_Blue_Base_1_1(); PixelShader = compile ps_1_1 PS_Blue_BaseMult_1_1(); } } technique Blue_SevenLight_1_1 { pass P0 { // Allow the use of multiple texcoord indices TexCoordIndex[0] = 0; TexCoordIndex[1] = 1; TexCoordIndex[2] = 2; TexCoordIndex[3] = 3; // Set the samplers Sampler[0] = ; Sampler[1] = ; // Enable depth writing ZEnable = TRUE; ZWriteEnable = TRUE; ZFunc = EQUAL; AlphaTestEnable = FALSE; AlphaBlendEnable = TRUE; SrcBlend = ONE; DestBlend = ONE; // Write to frame buffer's alpha channel only ColorWriteEnable = 0xF; // shaders VertexShader = compile vs_1_1 VS_Blue_Att_1_1(f3LightPos1, mtxLightRot1); PixelShader = compile ps_1_1 PS_Blue_Intensity_1_1(); } pass P1 { // Set the samplers Sampler[0] = ; Sampler[1] = ; // shaders VertexShader = compile vs_1_1 VS_Blue_Att_1_1(f3LightPos2, mtxLightRot2); PixelShader = compile ps_1_1 PS_Blue_Intensity_1_1(); } pass P2 { // Set the samplers Sampler[0] = ; Sampler[1] = ; // shaders VertexShader = compile vs_1_1 VS_Blue_Att_1_1(f3LightPos3, mtxLightRot3); PixelShader = compile ps_1_1 PS_Blue_Intensity_1_1(); } pass P3 { // Set the samplers Sampler[0] = ; Sampler[1] = ; // shaders VertexShader = compile vs_1_1 VS_Blue_Att_1_1(f3LightPos4, mtxLightRot4); PixelShader = compile ps_1_1 PS_Blue_Intensity_1_1(); } pass P4 { // Set the samplers Sampler[0] = ; Sampler[1] = ; // shaders VertexShader = compile vs_1_1 VS_Blue_Att_1_1(f3LightPos5, mtxLightRot5); PixelShader = compile ps_1_1 PS_Blue_Intensity_1_1(); } pass P5 { // Set the samplers Sampler[0] = ; Sampler[1] = ; // shaders VertexShader = compile vs_1_1 VS_Blue_Att_1_1(f3LightPos6, mtxLightRot6); PixelShader = compile ps_1_1 PS_Blue_Intensity_1_1(); } pass P6 { // Set the samplers Sampler[0] = ; Sampler[1] = ; // shaders VertexShader = compile vs_1_1 VS_Blue_Att_1_1(f3LightPos7, mtxLightRot7); PixelShader = compile ps_1_1 PS_Blue_Intensity_1_1(); } pass P7 { // Set the samplers Sampler[0] = ; // Enable alpha blending, multiply 2nd pass result by attenuation ramp in Frame Buffer alpha AlphaTestEnable = FALSE; AlphaBlendEnable = TRUE; SrcBlend = DESTCOLOR; DestBlend = ZERO; // Write to all channels ColorWriteEnable = 0xF; // shaders VertexShader = compile vs_1_1 VS_Blue_Base_1_1(); PixelShader = compile ps_1_1 PS_Blue_BaseMult_1_1(); } } technique Blue_EightLight_1_1 { pass P0 { // Allow the use of multiple texcoord indices TexCoordIndex[0] = 0; TexCoordIndex[1] = 1; TexCoordIndex[2] = 2; TexCoordIndex[3] = 3; // Set the samplers Sampler[0] = ; Sampler[1] = ; // Enable depth writing ZEnable = TRUE; ZWriteEnable = TRUE; ZFunc = EQUAL; AlphaTestEnable = FALSE; AlphaBlendEnable = TRUE; SrcBlend = ONE; DestBlend = ONE; // Write to frame buffer's alpha channel only ColorWriteEnable = 0xF; // shaders VertexShader = compile vs_1_1 VS_Blue_Att_1_1(f3LightPos1, mtxLightRot1); PixelShader = compile ps_1_1 PS_Blue_Intensity_1_1(); } pass P1 { // Set the samplers Sampler[0] = ; Sampler[1] = ; // shaders VertexShader = compile vs_1_1 VS_Blue_Att_1_1(f3LightPos2, mtxLightRot2); PixelShader = compile ps_1_1 PS_Blue_Intensity_1_1(); } pass P2 { // Set the samplers Sampler[0] = ; Sampler[1] = ; // shaders VertexShader = compile vs_1_1 VS_Blue_Att_1_1(f3LightPos3, mtxLightRot3); PixelShader = compile ps_1_1 PS_Blue_Intensity_1_1(); } pass P3 { // Set the samplers Sampler[0] = ; Sampler[1] = ; // shaders VertexShader = compile vs_1_1 VS_Blue_Att_1_1(f3LightPos4, mtxLightRot4); PixelShader = compile ps_1_1 PS_Blue_Intensity_1_1(); } pass P4 { // Set the samplers Sampler[0] = ; Sampler[1] = ; // shaders VertexShader = compile vs_1_1 VS_Blue_Att_1_1(f3LightPos5, mtxLightRot5); PixelShader = compile ps_1_1 PS_Blue_Intensity_1_1(); } pass P5 { // Set the samplers Sampler[0] = ; Sampler[1] = ; // shaders VertexShader = compile vs_1_1 VS_Blue_Att_1_1(f3LightPos6, mtxLightRot6); PixelShader = compile ps_1_1 PS_Blue_Intensity_1_1(); } pass P6 { // Set the samplers Sampler[0] = ; Sampler[1] = ; // shaders VertexShader = compile vs_1_1 VS_Blue_Att_1_1(f3LightPos7, mtxLightRot7); PixelShader = compile ps_1_1 PS_Blue_Intensity_1_1(); } pass P7 { // Set the samplers Sampler[0] = ; Sampler[1] = ; // shaders VertexShader = compile vs_1_1 VS_Blue_Att_1_1(f3LightPos8, mtxLightRot8); PixelShader = compile ps_1_1 PS_Blue_Intensity_1_1(); } pass P8 { // Set the samplers Sampler[0] = ; // Enable alpha blending, multiply 2nd pass result by attenuation ramp in Frame Buffer alpha AlphaTestEnable = FALSE; AlphaBlendEnable = TRUE; SrcBlend = DESTCOLOR; DestBlend = ZERO; // Write to all channels ColorWriteEnable = 0xF; // shaders VertexShader = compile vs_1_1 VS_Blue_Base_1_1(); PixelShader = compile ps_1_1 PS_Blue_BaseMult_1_1(); } }