Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/contentcreation/pps/MarkusWegmann/Godray Shader Proof of Concept/Godrays_raw.cgfx @ 11894

Last change on this file since 11894 was 8708, checked in by marwegma, 13 years ago

My Stuff

File size: 2.0 KB
Line 
1/**
2* \brief Godrays.cg is a CG (C for Graphics) shader collection to imitate the effects of lightray scattering through post-processing approaches.
3*
4* \author Markus Wegmann
5**/
6
7/*
8
9% Description of my shader.
10% Second line of description for my shader.
11
12keywords: material classic
13
14date: 20110410
15
16*/
17
18void sun_shader(
19    float4 position : POSITION,
20        float4 normal: NORMAL,
21
22    out float4 oPosition : POSITION,
23    out float4 oColor : COLOR,
24
25    uniform float4x4 modelViewProj,
26    uniform float4 sunColor)
27{
28    oPosition = mul(modelViewProj, position);
29    oColor    = 2 * normalize(sunColor);
30}
31
32
33void black_shader(
34    float4 position : POSITION,
35
36    out float4 oPosition : POSITION,
37        out float4 oColor: COLOR0,
38
39    uniform float4x4 modelViewProj)
40{
41    oPosition = mul(modelViewProj, position);
42    oColor    = float4 (0, 0, 0, 1);
43}
44
45
46//// Variables ////
47/////////////////////////////////////////////////////////////////////////////////////
48
49float4 SunLightColor : Specular <
50    string UIName =  "Lamp 0 Color";
51    string Object = "Pointlight0";
52    string UIWidget = "Color";
53> = {0.3, 0.42, 1, 1};
54
55//// UN-TWEAKABLES - AUTOMATICALLY-TRACKED TRANSFORMS ////
56
57float4x4 WorldITXf : WorldInverseTranspose < string UIWidget="None"; >;
58float4x4 WvpXf : WorldViewProjection < string UIWidget="None"; >;
59float4x4 VpXf : ViewProjection < string UIWidget="None"; >;
60float4x4 WorldXf : World < string UIWidget="None"; >;
61float4x4 ViewIXf : ViewInverse < string UIWidget="None"; >;
62
63
64//// Techniques ////
65technique SunShader
66{
67        pass p0 <
68        string Script = "Draw=geometry;";
69>       {
70                DepthTestEnable = true;
71                DepthMask = true;
72                BlendEnable = true;
73                CullFaceEnable = true;
74                       
75                VertexProgram = compile vp30 sun_shader(WvpXf, SunLightColor);         
76        }
77}
78
79technique BlackShader
80{
81                pass p0 <
82                string Script = "Draw=geometry;";
83>               {
84                        DepthTestEnable = true;
85                        DepthMask = true;
86                        BlendEnable = true;
87                        CullFaceEnable = true;
88               
89                        VertexProgram = compile vp30 black_shader(WvpXf);
90                }
91}
92
93
Note: See TracBrowser for help on using the repository browser.