Quality slider overwrites custom shader settings. All effects now listen to the new...
[fg:toms-fgdata.git] / Effects / tree.eff
1 <?xml version="1.0" encoding="utf-8"?>
2 <!-- Effects files for trees, which are placed by a shader. -->
3
4 <!-- Trees are drawn in two passes. The first draws the opaque parts
5      with z writes enabled. The second draws the the transparent bits
6      with z testing enabled and z writes disabled. The transparent
7      tree silhouettes will blend correctly against the opaque
8      geometry. They may cause artifacts when blending against other
9      edges, but the overall "forest" is supposed to be nice and
10      fuzzy. There might also be artifacts when blending over other
11      transparent objects, but that's mostly unavoidable.
12
13      Note: no sorting needed! -->
14 <PropertyList>
15         <name>Effects/tree</name>
16         <parameters>
17                 <texture n ="0">
18                 </texture>
19                 <!--    fog include -->
20                 <visibility>
21                         <use>/environment/ground-visibility-m</use>
22                 </visibility>
23                 <avisibility>
24                         <use>/environment/visibility-m</use>
25                 </avisibility>
26                 <lthickness>
27                         <use>/environment/ground-haze-thickness-m</use>
28                 </lthickness>
29                 <scattering>
30                         <use>/rendering/scene/scattering</use>
31                 </scattering>
32                 <terminator>
33                         <use>/environment/terminator-relative-position-m</use>
34                 </terminator>
35                 <fogtype>
36                         <use>/sim/rendering/shaders/skydome</use>
37                 </fogtype>
38                 <!--    END fog include -->
39         </parameters>
40         <technique n="10">
41                 <predicate>
42                         <and>
43                                 <property>/sim/rendering/random-vegetation</property>
44                                 <less-equal>
45                                         <value type="float">1.0</value>
46                                         <shader-language/>
47                                 </less-equal>
48                         </and>
49                 </predicate>
50                 <pass n="0">
51                         <lighting>true</lighting>
52                         <material>
53                                 <ambient type="vec4d">1.0 1.0 1.0 1.0</ambient>
54                                 <diffuse type="vec4d">1.0 1.0 1.0 1.0</diffuse>
55                                 <color-mode>off</color-mode>
56                         </material>
57                         <alpha-test>
58                                 <comparison>gequal</comparison>
59                                 <reference type="float">0.33</reference>
60                         </alpha-test>
61                         <texture-unit>
62                                 <unit>0</unit>
63                                 <type>2d</type>
64                                 <image>
65                                         <use>texture[0]/image</use>
66                                 </image>
67                                 <wrap-s>clamp</wrap-s>
68                                 <wrap-t>clamp</wrap-t>
69                         </texture-unit>
70                         <program>
71                                 <!--                            <vertex-shader>Shaders/include_fog.vert</vertex-shader> -->
72                                 <vertex-shader>Shaders/tree.vert</vertex-shader>
73                                 <fragment-shader n="0">Shaders/include_fog.frag</fragment-shader>
74                                 <fragment-shader n="1">Shaders/tree.frag</fragment-shader>
75                         </program>
76                         <uniform>
77                                 <name>baseTexture</name>
78                                 <type>sampler-2d</type>
79                                 <value type="int">0</value>
80                         </uniform>
81                         <!--        BEGIN fog include -->
82                         <uniform>
83                                 <name>visibility</name>
84                                 <type>float</type>
85                                 <value>
86                                         <use>visibility</use>
87                                 </value>
88                         </uniform>
89                         <uniform>
90                                 <name>avisibility</name>
91                                 <type>float</type>
92                                 <value>
93                                         <use>avisibility</use>
94                                 </value>
95                         </uniform>
96                         <uniform>
97                                 <name>hazeLayerAltitude</name>
98                                 <type>float</type>
99                                 <value>
100                                         <use>lthickness</use>
101                                 </value>
102                         </uniform>
103                         <uniform>
104                                 <name>scattering</name>
105                                 <type>float</type>
106                                 <value>
107                                         <use>scattering</use>
108                                 </value>
109                         </uniform>
110                         <uniform>
111                                 <name>terminator</name>
112                                 <type>float</type>
113                                 <value>
114                                         <use>terminator</use>
115                                 </value>
116                         </uniform>
117                         <uniform>
118                                 <name>fogType</name>
119                                 <type>int</type>
120                                 <value>
121                                         <use>fogtype</use>
122                                 </value>
123                         </uniform>
124                         <!--                    END fog include -->
125                 </pass>
126                 <pass n="1">
127                         <lighting>true</lighting>
128                         <material>
129                                 <ambient type="vec4d">1.0 1.0 1.0 1.0</ambient>
130                                 <diffuse type="vec4d">1.0 1.0 1.0 1.0</diffuse>
131                                 <color-mode>off</color-mode>
132                         </material>
133                         <render-bin>
134                                 <bin-number>2</bin-number>
135                                 <!-- RANDOM_OBJECTS_BIN -->
136                                 <bin-name>RenderBin</bin-name>
137                         </render-bin>
138                         <alpha-test>
139                                 <comparison>less</comparison>
140                                 <reference type="float">0.33</reference>
141                         </alpha-test>
142                         <blend>
143                                 <source>src-alpha</source>
144                                 <destination>one-minus-src-alpha</destination>
145                         </blend>
146                         <depth>
147                                 <write-mask>false</write-mask>
148                         </depth>
149                         <texture-unit>
150                                 <unit>0</unit>
151                                 <type>2d</type>
152                                 <image>
153                                         <use>texture[0]/image</use>
154                                 </image>
155                                 <wrap-s>clamp</wrap-s>
156                                 <wrap-t>clamp</wrap-t>
157                         </texture-unit>
158                         <program>
159                                 <vertex-shader n="0">Shaders/include_fog.vert</vertex-shader>
160                                 <vertex-shader n="1">Shaders/tree.vert</vertex-shader>
161                                 <fragment-shader n="0">Shaders/include_fog.frag</fragment-shader>
162                                 <fragment-shader n="1">Shaders/tree.frag</fragment-shader>
163                         </program>
164                         <uniform>
165                                 <name>baseTexture</name>
166                                 <type>sampler-2d</type>
167                                 <value type="int">0</value>
168                         </uniform>
169                         <!--        BEGIN fog include -->
170                         <uniform>
171                                 <name>visibility</name>
172                                 <type>float</type>
173                                 <value>
174                                         <use>visibility</use>
175                                 </value>
176                         </uniform>
177                         <uniform>
178                                 <name>avisibility</name>
179                                 <type>float</type>
180                                 <value>
181                                         <use>avisibility</use>
182                                 </value>
183                         </uniform>
184                         <uniform>
185                                 <name>hazeLayerAltitude</name>
186                                 <type>float</type>
187                                 <value>
188                                         <use>lthickness</use>
189                                 </value>
190                         </uniform>
191                         <uniform>
192                                 <name>scattering</name>
193                                 <type>float</type>
194                                 <value>
195                                         <use>scattering</use>
196                                 </value>
197                         </uniform>
198                         <uniform>
199                                 <name>terminator</name>
200                                 <type>float</type>
201                                 <value>
202                                         <use>terminator</use>
203                                 </value>
204                         </uniform>
205                         <uniform>
206                                 <name>fogType</name>
207                                 <type>int</type>
208                                 <value>
209                                         <use>fogtype</use>
210                                 </value>
211                         </uniform>
212                         <!--                    END fog include -->
213                 </pass>
214         </technique>
215 </PropertyList>