Quality slider overwrites custom shader settings. All effects now listen to the new...
[fg:toms-fgdata.git] / Effects / reflect.eff
1 <?xml version="1.0" encoding="utf-8"?>
2 <!-- Reflections
3
4         PARAMETERS: There are two forms of cube map texture:- vertical cross and 6 images.
5         Either can be used - alternative forms are shown in <parameters> and in <texture-unit>
6         The reflection is set proportional to the shininess of the material. Thus by
7         varying the material shininess value over or between objects the amount of
8         refection can be controlled. The overall amount of reflection may be
9         adjusted by the use of <refl_correction> -1.0 (fully transparent)- 1.0 (fully opaque).
10
11         The overall values of the noisiness, coloured fringing or fresnel effect may be adjusted
12         by the use of <noisiness>, <rainbowiness> and <fresneliness>.
13
14         If your result is too dark/too light the overall ambient light value can be adjusted
15         by the use of <ambient_correction>. This correction also takes out some of the blueness
16         added as default to compensate for the lack of reflection.
17
18         To use a reflection map set <reflect_map> to 1,and the path to the map texture in
19         <texture n="8">
20         
21         To use a light map set <light_map> to 1,and the path to the map texture in
22         <texture n="2">
23
24         USE:    To use the default reflection effect (controlled by material shininess values) use
25
26                 <effect>
27                         <inherits-from>Effects/reflect</inherits-from>
28                         <object-name>Fuselage</object-name>
29                 </<effect>
30
31         To use your own reflection effectuse
32
33                 <effect>
34                         <inherits-from>Aircraft/Lightning/Models/Effects/lightningreflect</inherits-from>
35                         <object-name>Fuselage</object-name>
36                 </<effect>
37
38         in your model file.
39
40         To use your own effect place your efffect file containing something like this:
41
42                 <name>Effects/lightningreflect</name>
43                 <inherits-from>Effects/reflect</inherits-from>
44
45         and the the modified tags in the path as above
46
47         EXAMPLES: You can find examples of both usages in the Hunter and Lightning models.
48 -->
49
50 <PropertyList>
51         <name>Effects/reflect</name>
52         <inherits-from>Effects/model-default</inherits-from>
53
54         <parameters>
55                 <texture n="2">
56                         <!--lightmap image -->
57                         <image>Aircraft/Generic/Effects/greymap.png</image>
58                         <filter>linear-mipmap-linear</filter>
59                         <wrap-s>repeat</wrap-s>
60                         <wrap-t>repeat</wrap-t>
61                         <internal-format>normalized</internal-format>
62                 </texture>
63
64                 <texture n="5">
65                         <type>cubemap</type>
66                         <!-- use this form for a cube cross -->
67                         <!--<image>Aircraft/Generic/Effects/CubeCrosses/blue_sky_big.jpg</image>-->
68
69                         <!-- use this form for a 6 image cube map -->
70                         <images>
71                                 <positive-x>Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_px.png</positive-x>
72                                 <negative-x>Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_nx.png</negative-x>
73                                 <positive-y>Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_py.png</positive-y>
74                                 <negative-y>Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_ny.png</negative-y>
75                                 <positive-z>Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_pz.png</positive-z>
76                                 <negative-z>Aircraft/Generic/Effects/CubeMaps/fair-sky/fair-sky_nz.png</negative-z>
77                         </images>
78
79                 </texture>
80                 <texture n="6">
81                         <image>Aircraft/Generic/Effects/Rainbow.png</image>
82                         <filter>linear-mipmap-linear</filter>
83                         <wrap-s>repeat</wrap-s>
84                         <wrap-t>repeat</wrap-t>
85                         <internal-format>normalized</internal-format>
86                 </texture>
87                 <texture n="7">
88                         <image>Aircraft/Generic/Effects/FresnelLookUp.png</image>
89                         <filter>linear-mipmap-linear</filter>
90                         <wrap-s>repeat</wrap-s>
91                         <wrap-t>repeat</wrap-t>
92                         <internal-format>normalized</internal-format>
93                 </texture>
94                 <texture n="8">
95                         <image>Aircraft/Generic/Effects/ReflectMaps/reflectmap.png</image>
96                         <filter>linear-mipmap-linear</filter>
97                         <wrap-s>repeat</wrap-s>
98                         <wrap-t>repeat</wrap-t>
99                         <internal-format>normalized</internal-format>
100                 </texture>
101                 <rendering-hint>transparent</rendering-hint>
102                 <shade-model>smooth</shade-model>
103                 <rainbowiness type="float">0.01</rainbowiness>
104                 <fresneliness>0.1</fresneliness>
105                 <noisiness>0.25</noisiness>
106                 <refl_correction>0.0</refl_correction>
107                 <ambient_correction>0.05</ambient_correction>
108                 <reflect_map type="int">0</reflect_map>
109                 <light_map type="int">0</light_map>
110                 <factor>1</factor>
111         </parameters>
112
113         <technique n="9">
114
115                 <predicate>
116                         <and>
117                                 <property>/sim/rendering/shaders/model</property>
118                                 <or>
119                                         <less-equal>
120                                                 <value type="float">2.0</value>
121                                                 <glversion/>
122                                         </less-equal>
123                                         <and>
124                                                 <extension-supported>GL_ARB_shader_objects</extension-supported>
125                                                 <extension-supported>GL_ARB_shading_language_100</extension-supported>
126                                                 <extension-supported>GL_ARB_vertex_shader</extension-supported>
127                                                 <extension-supported>GL_ARB_fragment_shader</extension-supported>
128                                         </and>
129                                 </or>
130                         </and>
131                 </predicate>
132
133                 <pass>
134                         <lighting>true</lighting>
135                         <material>
136                                 <active>
137                                         <use>material/active</use>
138                                 </active>
139                                 <ambient>
140                                         <use>material/ambient</use>
141                                 </ambient>
142                                 <diffuse>
143                                         <use>material/diffuse</use>
144                                 </diffuse>
145                                 <specular>
146                                         <use>material/specular</use>
147                                 </specular>
148                                 <emissive>
149                                         <use>material/emissive</use>
150                                 </emissive>
151                                 <shininess>
152                                         <use>material/shininess</use>
153                                 </shininess>
154                                 <color-mode>
155                                         <use>material/color-mode</use>
156                                 </color-mode>
157                         </material>
158                         <blend>
159                                 <active>
160                                         <use>blend/active</use>
161                                 </active>
162                                 <source>
163                                         <use>blend/source</use>
164                                 </source>
165                                 <destination>
166                                         <use>blend/destination</use>
167                                 </destination>
168                         </blend>
169                         <shade-model>
170                                 <use>shade-model</use>
171                         </shade-model>
172                         <cull-face>
173                                 <use>cull-face</use>
174                         </cull-face>
175                         <rendering-hint>
176                                 <use>rendering-hint</use>
177                         </rendering-hint>
178
179                         <texture-unit>
180                                 <unit>0</unit>
181                                 <image>
182                                         <use>texture[0]/image</use>
183                                 </image>
184                                 <filter>
185                                         <use>texture[0]/filter</use>
186                                 </filter>
187                                 <wrap-s>
188                                         <use>texture[0]/wrap-s</use>
189                                 </wrap-s>
190                                 <wrap-t>
191                                         <use>texture[0]/wrap-t</use>
192                                 </wrap-t>
193                                 <internal-format>
194                                         <use>texture[0]/internal-format</use>
195                                 </internal-format>
196                         </texture-unit>
197
198                         <texture-unit>
199                                 <unit>2</unit>
200                                 <type>
201                                         <use>texture[2]/type</use>
202                                 </type>
203                                 <image>
204                                         <use>texture[2]/image</use>
205                                 </image>
206                                 <filter>linear-mipmap-linear</filter>
207                                 <wrap-s>repeat</wrap-s>
208                                 <wrap-t>repeat</wrap-t>
209                         </texture-unit>
210
211                         <texture-unit>
212                                 <unit>5</unit>
213                                 <type>
214                                         <use>texture[5]/type</use>
215                                 </type>
216
217                                 <!-- use this form for a cube cross -->
218                                 <!--<image>
219                                         <use>texture[5]/image</use>
220                                 </image>-->
221
222                                 <!-- use this form for a 6 image cube map -->
223                                 <images>
224                                         <use>texture[5]/images</use>
225                                 </images>
226                         </texture-unit>
227
228                         <texture-unit>
229                                 <unit>6</unit>
230                                 <type>
231                                         <use>texture[6]/type</use>
232                                 </type>
233                                 <image>
234                                         <use>texture[6]/image</use>
235                                 </image>
236                                 <filter>
237                                         <use>texture[6]/filter</use>
238                                 </filter>
239                                 <wrap-s>
240                                         <use>texture[6]/wrap-s</use>
241                                 </wrap-s>
242                                 <wrap-t>
243                                         <use>texture[6]/wrap-t</use>
244                                 </wrap-t>
245                         </texture-unit>
246
247                         <texture-unit>
248                                 <unit>7</unit>
249                                 <type>
250                                         <use>texture[7]/type</use>
251                                 </type>
252                                 <image>
253                                         <use>texture[7]/image</use>
254                                 </image>
255                                 <filter>
256                                         <use>texture[7]/filter</use>
257                                 </filter>
258                                 <wrap-s>
259                                         <use>texture[7]/wrap-s</use>
260                                 </wrap-s>
261                                 <wrap-t>
262                                         <use>texture[7]/wrap-t</use>
263                                 </wrap-t>
264                         </texture-unit>
265
266                         <texture-unit>
267                                 <unit>8</unit>
268                                 <image>
269                                         <use>texture[8]/image</use>
270                                 </image>
271                                 <filter>
272                                         <use>texture[8]/filter</use>
273                                 </filter>
274                                 <wrap-s>
275                                         <use>texture[8]/wrap-s</use>
276                                 </wrap-s>
277                                 <wrap-t>
278                                         <use>texture[8]/wrap-t</use>
279                                 </wrap-t>
280                                 <internal-format>
281                                         <use>texture[8]/internal-format</use>
282                                 </internal-format>
283                         </texture-unit>
284
285                         <texture-unit>
286                                 <unit>9</unit>
287                                 <type>noise</type>
288                         </texture-unit>
289
290
291                         <program>
292                                 <vertex-shader>Shaders/reflect.vert</vertex-shader>
293                                 <fragment-shader>Shaders/reflect.frag</fragment-shader>
294                                 <attribute>
295                                         <name>tangent</name>
296                                         <index>6</index>
297                                 </attribute>
298                                 <attribute>
299                                         <name>binormal</name>
300                                         <index>7</index>
301                                 </attribute>
302                                 <attribute>
303                                         <name>normal</name>
304                                         <index>15</index>
305                                 </attribute>
306                         </program>
307
308                         <uniform>
309                                 <name>BaseTex</name>
310                                 <type>sampler-2d</type>
311                                 <value type="int">0</value>
312                         </uniform>
313
314                         <uniform>
315                                 <name>Lightmap</name>
316                                 <type>sampler-2d</type>
317                                 <value type="int">2</value>
318                         </uniform>
319
320                         <uniform>
321                                 <name>Environment</name>
322                                 <type>sampler-cube</type>
323                                 <value type="int">5</value>
324                         </uniform>
325
326                         <uniform>
327                                 <name>Rainbow</name>
328                                 <type>sampler-2d</type>
329                                 <value type="int">6</value>
330                         </uniform>
331
332                         <uniform>
333                                 <name>Fresnel</name>
334                                 <type>sampler-2d</type>
335                                 <value type="int">7</value>
336                         </uniform>
337
338                         <uniform>
339                                 <name>Map</name>
340                                 <type>sampler-2d</type>
341                                 <value type="int">8</value>
342                         </uniform>
343
344                         <uniform>
345                                 <name>Noise</name>
346                                 <type>sampler-3d</type>
347                                 <value type="int">9</value>
348                         </uniform>
349
350
351                         <!-- set the amount of fringing colour 0.0 - 1.0 -->
352                         <uniform>
353                                 <name>rainbowiness</name>
354                                 <type>float</type>
355                                 <value>
356                                         <use>rainbowiness</use>
357                                 </value>
358                         </uniform>
359
360                         <!-- set the amount of fresnel effect colour 0.0 - 1.0 -->
361                         <uniform>
362                                 <name>fresneliness</name>
363                                 <type>float</type>
364                                 <value>
365                                         <use>fresneliness</use>
366                                 </value>
367                         </uniform>
368
369                         <!-- set the amount of noisiness 0.0 - 1.0 -->
370                         <uniform>
371                                 <name>noisiness</name>
372                                 <type>float</type>
373                                 <value>
374                                         <use>noisiness</use>
375                                 </value>
376                         </uniform>
377
378                         <!-- The reflection is set proportional to the shininess of the material.
379                         The amount of reflection may be adjusted by the use of this correction
380                         -1.0 (fully transparent)- 1.0 (fully opaque) -->
381                         <uniform>
382                                 <name>refl_correction</name>
383                                 <type>float</type>
384                                 <value>
385                                         <use>refl_correction</use>
386                                 </value>
387                         </uniform>
388
389                         <!-- set the amount of ambient light correction 0.0 - 1.0  -->
390                         <uniform>
391                                 <name>ambient_correction</name>
392                                 <type>float</type>
393                                 <value>
394                                         <use>ambient_correction</use>
395                                 </value>
396                         </uniform>
397
398                         <!-- use a reflection map-->
399                         <uniform>
400                                 <name>reflect_map</name>
401                                 <type>int</type>
402                                 <value>
403                                         <use>reflect_map</use>
404                                 </value>
405                         </uniform>
406                         
407                         <!-- use a light map-->
408                         <uniform>
409                                 <name>light_map</name>
410                                 <type>int</type>
411                                 <value>
412                                         <use>light_map</use>
413                                 </value>
414                         </uniform>
415
416                         <uniform>
417                                 <name>lightmap_factor</name>
418                                 <type>float</type>
419                                 <value>
420                                         <use>factor</use>
421                                 </value>
422                         </uniform>
423
424                 </pass>
425         </technique>
426
427 </PropertyList>