//#define SHADOWMAP_SIZE 512.0f // Shadow map size //#define HALF_TEXEL 0.5f / (float)SHADOWMAP_SIZE // Size of the half texel float SHADOWMAP_SIZE; // Shadow map size float HALF_TEXEL; // Size of the half texel #define PI 3.14159265f // Value of PI float4x4 TexScaleBias; // Tranformation matrix between light and texture space float4x4 WorldLight; // To the light's camera space float4x4 WorldViewProj; // To the normalized screen space of the eye camera float4x4 WorldLightProj; // To the normalized screen space of the light camera texture g_txDefaultTexture; // Default texture of objects texture g_txShadowMapColor; // Shadow map texture texture g_txShadowMapZ; // Shadow map texture (Z) texture g_txShadowWeight; float4 g_vMaterial; // Diffuse color float g_fFov; // FOV of light float g_fLightSize; // Size of light source float g_fIntensity; // Helper float g_fShadowBias; // Shadow map bias float g_fBiasSlope; float near; // Light source near plane float far; // Light source far plane float g_fRealSamples; int g_iKernelSize; // kernel size bool g_bRenderBaseTexture; struct VS_INPUT { float4 Position : POSITION; // input position in modeling space float4 Color : COLOR0; // input color to be modulated by shadow float2 Tex : TEXCOORD0; }; struct VS_OUTPUT { float4 hPosition : POSITION; // in normalized device space float4 lcPosition : TEXCOORD1; // in light's camera space float4 ldPosition : TEXCOORD2; // in light's normalized devide space float4 Color : COLOR0; // input color to be modulated by shadow float2 Tex : TEXCOORD0; }; // Texture samplers sampler2D g_samScene = sampler_state { Texture = ; MinFilter = Point; MagFilter = Linear; MipFilter = Linear; }; sampler2D g_ShadowMapColorSampler = sampler_state { Texture = ; MinFilter = Linear; MagFilter = Linear; MipFilter = Linear; AddressU = Clamp; AddressV = Clamp; }; sampler2D g_ShadowWeightSampler = sampler_state { Texture = ; MinFilter = Linear; MagFilter = Linear; MipFilter = Linear; AddressU = Clamp; AddressV = Clamp; }; sampler2D g_ShadowMapZSampler_Point = sampler_state { Texture = ; MinFilter = Point; MagFilter = Point; MipFilter = Point; AddressU = Clamp; AddressV = Clamp; }; sampler2D g_ShadowMapZSampler_Linear = sampler_state { Texture = ; MinFilter = Linear; MagFilter = Linear; MipFilter = Linear; AddressU = Clamp; AddressV = Clamp; };