1 | /** |
---|
2 | * |
---|
3 | * @brief |
---|
4 | * Godrays_*.cg is a radial blur based shader implementation of the natural effects of godrays (ray light scattering). |
---|
5 | * Godrays_raw.cg includes the shader programs for the preparating step. |
---|
6 | * |
---|
7 | * @author Markus Wegmann |
---|
8 | * |
---|
9 | **/ |
---|
10 | |
---|
11 | |
---|
12 | void sun_shader( |
---|
13 | float4 position : POSITION, |
---|
14 | float4 normal: NORMAL, |
---|
15 | |
---|
16 | out float4 oPosition : POSITION, |
---|
17 | out float4 oColor : COLOR, |
---|
18 | |
---|
19 | uniform float4x4 modelViewProj, |
---|
20 | uniform float4 sunColor) |
---|
21 | { |
---|
22 | oPosition = mul(modelViewProj, position); |
---|
23 | oColor = 2 * normalize(sunColor); |
---|
24 | } |
---|
25 | |
---|
26 | |
---|
27 | void black_shader( |
---|
28 | float4 position : POSITION, |
---|
29 | |
---|
30 | out float4 oPosition : POSITION, |
---|
31 | out float4 oColor: COLOR0, |
---|
32 | |
---|
33 | uniform float4x4 modelViewProj) |
---|
34 | { |
---|
35 | oPosition = mul(modelViewProj, position); |
---|
36 | oColor = float4 (0, 0, 0, 1); |
---|
37 | } |
---|
38 | |
---|
39 | |
---|
40 | /* CgFx based code |
---|
41 | |
---|
42 | |
---|
43 | //// Variables //// |
---|
44 | ///////////////////////////////////////////////////////////////////////////////////// |
---|
45 | |
---|
46 | float4 SunLightColor : Specular < |
---|
47 | string UIName = "Lamp 0 Color"; |
---|
48 | string Object = "Pointlight0"; |
---|
49 | string UIWidget = "Color"; |
---|
50 | > = {0.3, 0.42, 1, 1}; |
---|
51 | |
---|
52 | //// UN-TWEAKABLES - AUTOMATICALLY-TRACKED TRANSFORMS //// |
---|
53 | |
---|
54 | float4x4 WorldITXf : WorldInverseTranspose < string UIWidget="None"; >; |
---|
55 | float4x4 WvpXf : WorldViewProjection < string UIWidget="None"; >; |
---|
56 | float4x4 VpXf : ViewProjection < string UIWidget="None"; >; |
---|
57 | float4x4 WorldXf : World < string UIWidget="None"; >; |
---|
58 | float4x4 ViewIXf : ViewInverse < string UIWidget="None"; >; |
---|
59 | |
---|
60 | |
---|
61 | //// Techniques //// |
---|
62 | technique SunShader |
---|
63 | { |
---|
64 | pass p0 < |
---|
65 | string Script = "Draw=geometry;"; |
---|
66 | > { |
---|
67 | DepthTestEnable = true; |
---|
68 | DepthMask = true; |
---|
69 | BlendEnable = true; |
---|
70 | CullFaceEnable = true; |
---|
71 | |
---|
72 | VertexProgram = compile vp40 sun_shader(WvpXf, SunLightColor); |
---|
73 | } |
---|
74 | } |
---|
75 | |
---|
76 | technique BlackShader |
---|
77 | { |
---|
78 | pass p0 < |
---|
79 | string Script = "Draw=geometry;"; |
---|
80 | > { |
---|
81 | DepthTestEnable = true; |
---|
82 | DepthMask = true; |
---|
83 | BlendEnable = true; |
---|
84 | CullFaceEnable = true; |
---|
85 | |
---|
86 | VertexProgram = compile vp40 black_shader(WvpXf); |
---|
87 | } |
---|
88 | } |
---|
89 | |
---|
90 | */ |
---|
91 | |
---|