Debian Codegraph @

Effects/light-cone.eff

raw
1 <?xml version="1.0" encoding="utf-8"?>
2
3 <!--
4
5 A light "cone" effect, written by Lauri Peltonen (Zan)
6
7 With this effect, any object (most likely a cone) will
8 light up everything inside of it. Might be usefull for
9 landing lights etc.
10
11 Uses stencil buffer.
12
13 -->
14
15
16 <PropertyList>
17 <name>Effects/light-cone</name>
18 <inherits-from>Effects/model-default</inherits-from>
19 <parameters>
20 <texture n ="0">
21 <type>white</type>
22 </texture>
23
24 <!-- Dunno if this does anything, it could be removed
25 what does this do with rendering-hint=transparent? -->
26 <render-bin>
27 <active>true</active>
28 <bin-number>9</bin-number>
29 <bin-name>RenderBin</bin-name>
30 </render-bin>
31
32 </parameters>
33 <technique n="8">
34
35 <!-- First pass, increase stencil when ground is in front of
36 the lighting object -->
37 <pass>
38 <render-bin>
39 <active>true</active>
40 <bin-number>9</bin-number>
41 <bin-name>RenderBin</bin-name>
42 </render-bin>
43
44 <lighting>false</lighting>
45
46 <color-mask type="vec4d">0 0 0 0</color-mask> <!-- do not draw anything -->
47
48 <shade-model><use>shade-model</use></shade-model>
49 <cull-face>front</cull-face>
50 <!-- <rendering-hint>transparent</rendering-hint> -->
51 <depth>
52 <write-mask>false</write-mask>
53 </depth>
54
55 <!-- Set stencil buffer to 1 if ground is in front of the back side
56 of the light volume, otherwise zero -->
57 <stencil>
58 <function>always</function> <!-- S-test passes always -->
59 <value>1</value>
60 <z-fail>replace</z-fail> <!-- Replace current s-buffer with value 1 -->
61 <pass>zero</pass> <!-- Zero everything "behind" the volume -->
62 </stencil>
63 </pass>
64
65
66 <!-- Second pass, decrease stencil when ground is in front of the front
67 side of the volume, in stencil buffer, 1 exists where ground
68 (or other objects) is inside the lighting object! -->
69 <pass>
70 <render-bin>
71 <active>true</active>
72 <bin-number>9</bin-number>
73 <bin-name>RenderBin</bin-name>
74 </render-bin>
75
76 <lighting>false</lighting>
77 <color-mask type="vec4d">0 0 0 0</color-mask> <!-- Do not draw anything -->
78 <shade-model><use>shade-model</use></shade-model>
79 <cull-face>back</cull-face>
80 <!-- <rendering-hint>transparent</rendering-hint> -->
81 <depth>
82 <write-mask>false</write-mask>
83 </depth>
84
85 <!-- Set s-buffer to 0 when ground is in front of the front side of the volume -->
86 <stencil>
87 <function>always</function> <!-- S-test passes always -->
88 <z-fail>zero</z-fail> <!-- Zero s-buffer when z-buffer test fails -->
89 </stencil>
90 </pass>
91
92 <!-- Third pass, render light where there is 1 on stencil buffer -->
93 <pass>
94 <render-bin>
95 <active>true</active>
96 <bin-number>9</bin-number>
97 <bin-name>RenderBin</bin-name>
98 </render-bin>
99
100 <lighting>false</lighting>
101 <shade-model><use>shade-model</use></shade-model>
102 <cull-face>back</cull-face>
103 <!-- <rendering-hint>transparent</rendering-hint> -->
104 <depth>
105 <write-mask>false</write-mask>
106 </depth>
107
108 <!-- Draw when S-buffer EQUALS value 1 -->
109 <stencil>
110 <function>equal</function>
111 <value>1</value>
112 </stencil>
113
114 <!-- Do additive blending, so increase the color value of
115 the existing pixel by the light's color. The light object should
116 have ambient & diffuse AND alpha should be around 0.2 or something -->
117 <blend>
118 <active>true</active>
119 <source-rgb>dst-color</source-rgb>
120 <source>dst-alpha</source>
121 <destination>one</destination>
122 </blend>
123
124 </pass>
125
126 </technique>
127 </PropertyList>