#line 1 "complex-ogre-grass2-in.txt" // shadow receiver void main( float4 position : POSITION , float4 shadowUV : TEXCOORD0 , float3 uv : TEXCOORD1 , float4 vertexLight : COLOR , out float4 oColour : COLOR , uniform sampler2D shadowMap : register(s0) , uniform sampler2D diffuseMap : register(s1) //, uniform float inverseShadowmapSize , uniform float fixedDepthBias , uniform float gradientClamp , uniform float gradientScaleBias ) { if (shadowUV.z > 0) { float4 diffuse = tex2D(diffuseMap, uv.xy); if (diffuse.a > 0.001) { oColour = float4(0.0f, 0.0f, 0.0f, 0.0f); } else { // point on shadowmap (no gradient as cg1.4 compiler is unable to handle that complexity) shadowUV = shadowUV / shadowUV.w; float4 shadowDepths = tex2D(shadowMap, shadowUV.xy); float gradientFactor = gradientClamp * gradientScaleBias; float depthAdjust = gradientFactor + fixedDepthBias * shadowDepths.x; float centerdepth = shadowDepths.x + depthAdjust; oColour = (centerdepth > shadowUV.z) ? float4(vertexLight.rgb, diffuse.a) : float4(0, 0, 0, diffuse.a); } } else { oColour = float4(0.0f, 0.0f, 0.0f, 0.0f); } }