string description = "Simple"; /************* UN-TWEAKABLES **************/ float4x4 vP : ViewProjection; float4x4 wM : World; float4 inverseParams; float3 colourMod = {1.f, 1.f, 1.f}; /*********** Tweakables **********************/ float uvTileBase < string UIWidget = "slider"; float UIMin = 0.0; float UIMax = 5.0; float UIStep = 0.01; > = 1.0; /************* Textures ******************/ texture cm : Diffuse < string ResourceType = "2D"; >; sampler2D baseColourMap = sampler_state { Texture = ; MinFilter = LinearMipMapLinear; MagFilter = Linear; }; float intensity < string UIWidget = "slider"; float UIMin = 0.0; float UIMax = 10.0; float UIStep = 0.01; > = 1.0f; float OffsetU < string UIWidget = "slider"; float UIMin = 0.0; float UIMax = 1.0; float UIStep = 0.01; > = 0.0; float OffsetV < string UIWidget = "slider"; float UIMin = 0.0; float UIMax = 1.0; float UIStep = 0.01; > = 0.0; float ScaleU < string UIWidget = "slider"; float UIMin = -1.0; float UIMax = 2.0; float UIStep = 0.01; > = 1.0; float ScaleV < string UIWidget = "slider"; float UIMin = -1.0; float UIMax = 2.0; float UIStep = 0.01; > = 1.0; #include "selfIllumDepthAlphaTest.cgfx" /************* DATA STRUCTS **************/ /* data from application vertex buffer */ struct appdata { float4 position : POSITION; half3 normal : NORMAL; half2 texCoord : TEXCOORD0; }; /* data from application vertex buffer */ struct appdataColour { float4 position : POSITION; half3 normal : NORMAL; half2 texCoord : TEXCOORD0; half4 colour : COLOR0; }; /* data passed from vertex shader to pixel shader */ struct vertexOutput { float4 position : POSITION; half2 texCoord : TEXCOORD0; }; /* data passed from vertex shader to pixel shader */ struct vertexColourOutput { float4 position : POSITION; half2 texCoord : TEXCOORD0; half4 colour : COLOR0; }; /*********** vertex program ******/ vertexOutput simpleVP(appdata IN) { vertexOutput OUT = (vertexOutput)0; //constants #ifdef _PRAETORIAN_ OUT.texCoord = IN.texCoord * float2(ScaleU, ScaleV) + float2(OffsetU, -OffsetV); #else OUT.texCoord = IN.texCoord * float2(ScaleU, ScaleV) + float2(OffsetU, OffsetV); #endif //postion OUT.position = mul(mul(vP, wM), IN.position); return OUT; } vertexColourOutput simpleColourVP(appdataColour IN) { vertexColourOutput OUT = (vertexColourOutput)0; //constants #ifdef _PRAETORIAN_ OUT.texCoord = IN.texCoord * float2(ScaleU, ScaleV) + float2(OffsetU, -OffsetV); #else OUT.texCoord = IN.texCoord * float2(ScaleU, ScaleV) + float2(OffsetU, OffsetV); #endif //postion OUT.position = mul(mul(vP, wM), IN.position); OUT.colour = IN.colour; return OUT; } /********* fragment program ********/ void simpleFP(vertexOutput IN, out float4 colour : COLOR0) { colour = float4(tex2D(baseColourMap, IN.texCoord).xyz * intensity * colourMod.rgb, 1); // Encode to RGBdiv8 colour = colour/max(max(colour.r, colour.g), max(colour.b, 1.1f)); } void simpleColourFP(vertexColourOutput IN, out float4 colour : COLOR0) { colour = float4(tex2D(baseColourMap, IN.texCoord).xyz * intensity * colourMod.rgb * IN.colour.rgb, 1); // Encode to RGBdiv8 colour = colour/max(max(colour.r, colour.g), max(colour.b, 1.1f)); } /*************/ technique basic < string layer = "Transparent" ; > { pass p0 { VertexProgram = compile vp30 simpleVP(); FragmentProgram = compile fp40 simpleFP(); DepthTestEnable = true; DepthMask = false; BlendEnable = true; BlendFuncSeparate = int4( DstAlpha , SrcAlpha , DstAlpha , Zero ) ; CullFaceEnable = false; } pass selfIllumDepthPass < string layer = "TransparentDepth" ; string excludeLayer = "PostFog" ; > { VertexProgram = compile vp30 SIDepthVP(); FragmentProgram = compile fp30 SIDepthFP(); ColorMask = bool4( false , false , false , true ); DepthTestEnable = true; DepthMask = false; BlendEnable = false; } } technique basic_vertexColours < string layer = "Transparent" ; > { pass p0 { VertexProgram = compile vp30 simpleColourVP(); FragmentProgram = compile fp40 simpleColourFP(); DepthTestEnable = true; DepthMask = false; BlendEnable = true; BlendFuncSeparate = int4( DstAlpha , SrcAlpha , DstAlpha , Zero ) ; CullFaceEnable = false; } pass selfIllumDepthPass < string layer = "TransparentDepth" ; string excludeLayer = "PostFog" ; > { VertexProgram = compile vp30 SIDepthVP(); FragmentProgram = compile fp30 SIDepthFP(); ColorMask = bool4( false , false , false , true ); DepthTestEnable = true; DepthMask = false; BlendEnable = false; } } /***************************** eof ***/