source: GTP/trunk/App/Demos/Illum/Illumination Networks Demo [OpenGL]/src/DepthPeel.cg @ 845

Revision 845, 960 bytes checked in by szirmay, 18 years ago (diff)
Line 
1struct VertexOut
2{
3        float4 VertexPosition           :POSITION;
4        float2 TexCoord                         :TEXCOORD;
5        float3 Position                         :TEXCOORD1;
6        float ID                                        :TEXCOORD2;
7};
8
9
10/*
11  Vertex program for cloud rendering
12*/
13VertexOut VertexProgram( float4 Position :POSITION,
14                                                float ID: TEXCOORD,
15                                                uniform float WindowSize,
16                                                uniform float4x4 ModelViewProj  :state.matrix.mvp
17                                                )                                                                       
18{
19        VertexOut Out; 
20       
21        Out.VertexPosition=mul(ModelViewProj, Position);
22       
23        Out.ID=ID;
24       
25        Out.Position=Out.VertexPosition.xyz/2+0.5;
26        Out.Position.xy*=WindowSize;
27       
28        return Out;     
29}
30
31/*
32  Fragment program for cloud rendering
33*/
34void FragmentProgram(   VertexOut       In,
35                                                uniform samplerRECT PrevFrame,
36                                                out float4 Color:COLOR,
37                                                uniform float peel
38                                                //,out float Depth:DEPTH
39                                                )
40{       
41        float z0=texRECT(PrevFrame,In.Position.xy).g;   
42        Color=float4(1,In.Position.z,0,1);     
43       
44        if(In.Position.z<=peel)
45        {
46                Color.a=0;
47        }               
48       
49}
50
51
Note: See TracBrowser for help on using the repository browser.