string description = "Simple"; /************* UN-TWEAKABLES **************/ float4x4 vP : ViewProjection < string UIWidget="None"; >; float4x4 wM : World < string UIWidget="None"; >; /*********** Tweakables **********************/ float3 colourMod = {1.f, 1.f, 1.f}; float intensity < string UIWidget = "slider"; float UIMin = 0.0; float UIMax = 10.0; float UIStep = 0.01; > = 1.0; 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; /************* Textures ******************/ texture cm : Diffuse < string ResourceType = "2D"; string UIWidget="None"; >; sampler2D baseColourMap = sampler_state { Texture = ; MinFilter = None; MipFilter = None; MagFilter = None; WrapS = ClampToEdge; WrapT = ClampToEdge; }; #include "selfIllumDepth.cgfx" /************* DATA STRUCTS **************/ /* data from application vertex buffer */ struct appdata { float4 position : POSITION; float2 texCoord0 : TEXCOORD0; }; /* data passed from vertex shader to pixel shader */ struct vertexOutput { float4 position : POSITION; float2 texCoord : TEXCOORD0; }; /*********** vertex program ******/ vertexOutput simpleVP(appdata IN) { vertexOutput OUT = (vertexOutput)0; //constants OUT.texCoord = IN.texCoord0 + float2(OffsetU * ScaleU, OffsetV * ScaleV); //postion OUT.position = mul(mul(vP, wM), IN.position); return OUT; } /********* fragment program ********/ float4 simpleFP(vertexOutput IN) : COLOR { float4 colour = float4(tex2D(baseColourMap, IN.texCoord).xyz * intensity, 1); colour = colour/max(max(colour.r, colour.g), max(colour.b, 1.f)); return colour; } float4 colourModFP(vertexOutput IN) : COLOR { float4 colour = float4(tex2D(baseColourMap, IN.texCoord).xyz * intensity * colourMod, 1); colour = colour/max(max(colour.r, colour.g), max(colour.b, 1.f)); return colour; } /*************/ technique basic < string layer = "SelfIlluminated" ; > { pass p0 { VertexProgram = compile vp30 simpleVP(); FragmentProgram = compile fp30 simpleFP(); DepthTestEnable = true; DepthMask = true; BlendEnable = false; } pass selfIllumDepthPass < string layer = "SelfIlluminatedDepth" ; string excludeLayer = "PostFog" ; > { VertexProgram = compile vp30 SIDepthVP(); FragmentProgram = compile fp30 SIDepthFP(); ColorMask = bool4( false , false , false , true ); DepthTestEnable = true; DepthMask = false; BlendEnable = false; } } technique colourMod < string layer = "SelfIlluminated" ; > { pass p0 { VertexProgram = compile vp30 simpleVP(); FragmentProgram = compile fp30 colourModFP(); DepthTestEnable = true; DepthMask = true; BlendEnable = false; } pass selfIllumDepthPass < string layer = "SelfIlluminatedDepth" ; string excludeLayer = "PostFog" ; > { VertexProgram = compile vp30 SIDepthVP(); FragmentProgram = compile fp30 SIDepthFP(); ColorMask = bool4( false , false , false , true ); DepthTestEnable = true; DepthMask = false; BlendEnable = false; } } /***************************** eof ***/