source: GTP/branches/IllumWPdeliver2008dec/IlluminationWP/demos/Standalone/Hierarchical Systems Demo [OpenGL]/src/PhaseFunction.cg @ 3255

Revision 3255, 651 bytes checked in by szirmay, 15 years ago (diff)
Line 
1struct VertexOut
2{
3        float4 VertexPosition           :POSITION;
4        float2 TexCoord                         :TEXCOORD;
5};
6
7
8/*
9  Vertex program for cloud rendering
10*/
11VertexOut VertexProgram( float4 Position :POSITION,
12                                                float2 Texcoord: TEXCOORD
13                                                )                                                                       
14{
15        VertexOut Out; 
16       
17        Out.VertexPosition=Position;
18        Out.TexCoord=Texcoord*2.0-1.0;
19       
20        return Out;     
21}
22
23/*
24  Fragment program for cloud rendering
25*/
26float4 FragmentProgram( VertexOut       In):COLOR
27{
28        float4 Color;
29        float2 UV=In.TexCoord;
30        float g2=UV.x*UV.x;
31        float phase=3*(1-g2)*(1+UV.y*UV.y)/2/(2+g2)/pow((1+g2-2*(UV.y)*(UV.x)),1.5);
32        Color=float4(phase,1,1,1);
33       
34        return Color;
35}
36
Note: See TracBrowser for help on using the repository browser.