string description = "Simple"; /************* UN-TWEAKABLES **************/ float4x4 vP : ViewProjection; float4x4 wM : World; float4 inverseParams; /*********** 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.0; #include "selfIllumDepthAlphaTest.cgfx" /************* DATA STRUCTS **************/ /* data from application vertex buffer */ struct appdata { float4 position : POSITION; half3 normal : NORMAL; half2 texCoord : TEXCOORD0; }; /* data passed from vertex shader to pixel shader */ struct vertexOutput { float4 position : POSITION; half2 texCoord : TEXCOORD0; }; /*********** vertex program ******/ vertexOutput simpleVP(appdata IN) { vertexOutput OUT = (vertexOutput)0; //constants OUT.texCoord.xy = IN.texCoord; //postion OUT.position = mul(mul(vP, wM), IN.position); return OUT; } /********* fragment program ********/ void simpleFP(vertexOutput IN, out float4 colour : COLOR0) { colour = float4(tex2D(baseColourMap, IN.texCoord).xyz * intensity, 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 arbvp1 simpleVP(); FragmentProgram = compile fp40 simpleFP(); DepthTestEnable = true; DepthMask = false; BlendEnable = true; BlendFuncSeparate = int4( DstAlpha , SrcAlpha , DstAlpha , Zero ) ; } 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 ***/