[1637] | 1 | // Percentage closer soft shadows
|
---|
| 2 | // Our PC sodt fhadow implementation
|
---|
| 3 |
|
---|
| 4 | // SHADOWMAP generation
|
---|
| 5 |
|
---|
| 6 | //-----------------------------------------------------------------------------
|
---|
| 7 | // Vertex Shader: RenderShadowMap_Focusing_VS
|
---|
| 8 | // Desc: Process vertex for the shadow map
|
---|
| 9 | //-----------------------------------------------------------------------------
|
---|
| 10 | VS_OUTPUT RenderFocusingMap_VS( VS_INPUT IN )
|
---|
| 11 | {
|
---|
| 12 | VS_OUTPUT OUT = (VS_OUTPUT)0;
|
---|
| 13 | OUT.Color = IN.Color;
|
---|
| 14 | OUT.Tex = IN.Tex;
|
---|
| 15 | // transform model-space vertex position to light's normalized device space:
|
---|
| 16 | OUT.ldPosition = mul(IN.Position, WorldLightProj);
|
---|
| 17 |
|
---|
| 18 | // transform model-space vertex position to normalized screen space:
|
---|
| 19 | OUT.hPosition = mul(IN.Position, WorldViewProj);
|
---|
| 20 | return OUT;
|
---|
| 21 | }
|
---|
| 22 |
|
---|
| 23 | //-----------------------------------------------------------------------------
|
---|
| 24 | // Pixel Shader: RenderShadowMapPS_Focusing_PS
|
---|
| 25 | // Desc: Process pixel for the shadow map
|
---|
| 26 | // Writes uv coordinate of light's camera space
|
---|
| 27 | //-----------------------------------------------------------------------------
|
---|
| 28 | float4 RenderFocusingMap_PS( VS_OUTPUT IN ):COLOR
|
---|
| 29 | {
|
---|
| 30 | float3 lexel = IN.ldPosition.xyz / IN.ldPosition.w;
|
---|
| 31 | return float4( lexel, 1 );
|
---|
| 32 | }
|
---|
| 33 |
|
---|
| 34 |
|
---|
| 35 | // TECHNIQUE
|
---|
| 36 |
|
---|
| 37 | //-----------------------------------------------------------------------------
|
---|
| 38 | // Techniques: RenderShadowMap
|
---|
| 39 | // Desc: Render the shadow map
|
---|
| 40 | //-----------------------------------------------------------------------------
|
---|
| 41 |
|
---|
| 42 | technique RenderFocusingMap
|
---|
| 43 | {
|
---|
| 44 | pass p0
|
---|
| 45 | {
|
---|
| 46 | VertexShader = compile vs_2_0 RenderFocusingMap_VS();
|
---|
| 47 | PixelShader = compile ps_2_0 RenderFocusingMap_PS();
|
---|
| 48 | }
|
---|
| 49 | } |
---|