source: GTP/trunk/App/Demos/Illum/SoftShadowMap/ShadowMap.fx @ 1637

Revision 1637, 3.9 KB checked in by szirmay, 18 years ago (diff)
Line 
1#include "properties.fx"
2
3#include "Shaders/technique_00.fx"
4#include "Shaders/technique_06.fx"
5#include "Shaders/technique_07.fx"
6
7#include "Shaders/technique_focusing.fx"
8
9
10//-----------------------------------------------------------------------------
11// RenderMapScreen
12// This shader renders the PhotonMap texture (g_txPhotonUVTexture) into the screen lower left corner.
13// This texture contains the PhotonHits positions and ObjectIDs.
14// The result is displayed on the screen.
15//-----------------------------------------------------------------------------
16
17void RenderMapScreenVS(
18                float4 Pos     : POSITION,
19    out float4 outhPos : POSITION,
20    out float2 outTex  : TEXCOORD0 )
21{
22        outhPos = float4( Pos.xy, 0.0f, 1.0f );
23    outTex.x =  Pos.x * 0.5f + 0.5f;
24    outTex.y = -Pos.y * 0.5f + 0.5f;
25}
26// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
27
28float4 RenderMapScreenPS(
29                float2 Tex : TEXCOORD0 ) : COLOR
30{
31        //return 1;
32        half4 retColor = half4(0,0,0,1);
33        return tex2D( g_ShadowWeightSampler, Tex );
34}
35//*****************************************************************************
36
37void RenderMapScreen2VS(
38                float4 Pos     : POSITION,
39    out float4 outhPos : POSITION,
40    out float2 outTex  : TEXCOORD0 )
41{
42        outhPos = float4( Pos.xy * 0.5f, 0.0f, 1.0f );
43    outTex.x =  Pos.x * 0.5f + 0.5f;
44    outTex.y = -Pos.y * 0.5f + 0.5f;
45}
46// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
47
48float4 RenderMapScreen2PS(
49                float2 Tex : TEXCOORD0 ) : COLOR
50{
51        //return 1;
52        half4 retColor = half4(g_fIntensity,0,0,1);
53        return retColor;
54}
55
56
57
58
59
60
61
62
63
64
65//*********************************************************************************************************
66//*********************************************************************************************************
67
68// LIGHT SOURCE RENDERING
69
70//*********************************************************************************************************
71//*********************************************************************************************************
72
73//-----------------------------------------------------------------------------
74// Vertex Shader: RenderLightVS
75// Desc: Process vertex for the light object
76//-----------------------------------------------------------------------------
77VS_OUTPUT RenderLightVS( VS_INPUT IN )
78{
79        VS_OUTPUT OUT = (VS_OUTPUT)0;
80        OUT.Color = IN.Color;
81        OUT.Tex = IN.Tex;
82        OUT.ldPosition = float4(0,0,0,0);
83
84        // transform model-space vertex position to normalized screen space:
85        OUT.hPosition = mul(IN.Position, WorldViewProj);
86        return OUT;
87}
88
89
90//-----------------------------------------------------------------------------
91// Pixel Shader: RenderLightPS
92// Desc: Process pixel for the light object
93//-----------------------------------------------------------------------------
94float4 RenderLightPS( VS_OUTPUT IN ) : COLOR
95{
96    return tex2D( g_samScene, IN.Tex );
97}
98
99
100//-----------------------------------------------------------------------------
101// Technique: RenderLight
102// Desc: Renders the light object
103//-----------------------------------------------------------------------------
104technique RenderLight
105{
106    pass p0
107    {
108        VertexShader = compile vs_2_0 RenderLightVS();
109        PixelShader  = compile ps_2_0 RenderLightPS();
110    }
111}
112
113//-----------------------------------------------------------------------------
114// Technique: RenderMapScreen
115// Desc: Renders the map
116//-----------------------------------------------------------------------------
117technique RenderMapScreen
118{
119    pass p0
120    {
121        VertexShader = compile vs_2_0 RenderMapScreenVS();
122        PixelShader  = compile ps_2_0 RenderMapScreenPS();
123    }
124}
125technique RenderMapScreen2
126{
127    pass p0
128    {
129        VertexShader = compile vs_2_0 RenderMapScreen2VS();
130        PixelShader  = compile ps_2_0 RenderMapScreen2PS();
131    }
132}
Note: See TracBrowser for help on using the repository browser.