1 | // -------------------------------
|
---|
2 | // Cel Shading Section
|
---|
3 | // -------------------------------
|
---|
4 | vertex_program Ogre/CelShadingVP cg
|
---|
5 | {
|
---|
6 | source Example_CelShading.cg
|
---|
7 | entry_point main_vp
|
---|
8 | profiles vs_1_1 arbvp1
|
---|
9 |
|
---|
10 | default_params
|
---|
11 | {
|
---|
12 | param_named_auto lightPosition light_position_object_space 0
|
---|
13 | param_named_auto eyePosition camera_position_object_space
|
---|
14 | param_named_auto worldViewProj worldviewproj_matrix
|
---|
15 | param_named shininess float 10
|
---|
16 | }
|
---|
17 | }
|
---|
18 |
|
---|
19 | fragment_program Ogre/CelShadingFP cg
|
---|
20 | {
|
---|
21 | source Example_CelShading.cg
|
---|
22 | entry_point main_fp
|
---|
23 | profiles ps_1_1 arbfp1 fp20
|
---|
24 | }
|
---|
25 |
|
---|
26 |
|
---|
27 | material Examples/CelShading
|
---|
28 | {
|
---|
29 | technique
|
---|
30 | {
|
---|
31 | pass
|
---|
32 | {
|
---|
33 | vertex_program_ref Ogre/CelShadingVP
|
---|
34 | {
|
---|
35 | // map shininess from custom renderable param 1
|
---|
36 | param_named_auto shininess custom 1
|
---|
37 | }
|
---|
38 | fragment_program_ref Ogre/CelShadingFP
|
---|
39 | {
|
---|
40 | // map diffuse from custom renderable param 2
|
---|
41 | param_named_auto diffuse custom 2
|
---|
42 | // map specular from custom renderable param 2
|
---|
43 | param_named_auto specular custom 3
|
---|
44 | }
|
---|
45 | texture_unit
|
---|
46 | {
|
---|
47 | texture cel_shading_diffuse.png 1d
|
---|
48 | tex_address_mode clamp
|
---|
49 | filtering none
|
---|
50 | }
|
---|
51 | texture_unit
|
---|
52 | {
|
---|
53 | texture cel_shading_specular.png 1d
|
---|
54 | tex_address_mode clamp
|
---|
55 | filtering none
|
---|
56 | tex_coord_set 1
|
---|
57 | }
|
---|
58 | texture_unit
|
---|
59 | {
|
---|
60 | texture cel_shading_edge.png 1d
|
---|
61 | tex_address_mode clamp
|
---|
62 | filtering none
|
---|
63 | tex_coord_set 2
|
---|
64 | }
|
---|
65 | }
|
---|
66 | }
|
---|
67 |
|
---|
68 | }
|
---|
69 |
|
---|
70 |
|
---|
71 |
|
---|
72 | //------------------------
|
---|
73 | // Bump mapping section
|
---|
74 | //------------------------
|
---|
75 |
|
---|
76 | // Bump map vertex program, support for this is required
|
---|
77 | vertex_program Examples/BumpMapVP cg
|
---|
78 | {
|
---|
79 | source Example_BumpMapping.cg
|
---|
80 | entry_point main_vp
|
---|
81 | profiles vs_1_1 arbvp1
|
---|
82 | }
|
---|
83 |
|
---|
84 | // Bump map fragment program, support for this is optional
|
---|
85 | fragment_program Examples/BumpMapFP cg
|
---|
86 | {
|
---|
87 | source Example_BumpMapping.cg
|
---|
88 | entry_point main_fp
|
---|
89 | profiles ps_1_1 arbfp1 fp20
|
---|
90 | }
|
---|
91 |
|
---|
92 | // Bump map vertex program shadow receiver
|
---|
93 | vertex_program Examples/BumpMapVPShadowRcv cg
|
---|
94 | {
|
---|
95 | source Example_BumpMapping.cg
|
---|
96 | entry_point main_shadowreceiver_vp
|
---|
97 | profiles vs_1_1 arbvp1
|
---|
98 | }
|
---|
99 | // Bump map fragment program shadow receiver, support for this is optional
|
---|
100 | fragment_program Examples/BumpMapFPShadowRcv cg
|
---|
101 | {
|
---|
102 | source Example_BumpMapping.cg
|
---|
103 | entry_point main_shadowreceiver_fp
|
---|
104 | profiles ps_1_1 arbfp1 fp20
|
---|
105 | }
|
---|
106 |
|
---|
107 |
|
---|
108 | // Bump map with specular vertex program, support for this is required
|
---|
109 | vertex_program Examples/BumpMapVPSpecular cg
|
---|
110 | {
|
---|
111 | source Example_BumpMapping.cg
|
---|
112 | entry_point specular_vp
|
---|
113 | profiles vs_1_1 arbvp1
|
---|
114 | }
|
---|
115 |
|
---|
116 | // Bump map fragment program, support for this is optional
|
---|
117 | fragment_program Examples/BumpMapFPSpecular cg
|
---|
118 | {
|
---|
119 | source Example_BumpMapping.cg
|
---|
120 | entry_point specular_fp
|
---|
121 | profiles ps_1_1 arbfp1 fp20
|
---|
122 | }
|
---|
123 |
|
---|
124 | // Single light material, less passes (one pass on a 4-unit card)
|
---|
125 | material Examples/BumpMapping/SingleLight
|
---|
126 | {
|
---|
127 | // Preferred technique, uses vertex and fragment programs
|
---|
128 | // to support a single coloured light
|
---|
129 | technique
|
---|
130 | {
|
---|
131 | pass
|
---|
132 | {
|
---|
133 | // base colours, not needed for rendering, but as information
|
---|
134 | // to lighting pass categorisation routine
|
---|
135 | ambient 0 0 0
|
---|
136 | // Vertex program reference
|
---|
137 | vertex_program_ref Examples/BumpMapVP
|
---|
138 | {
|
---|
139 | param_named_auto lightPosition light_position_object_space 0
|
---|
140 | param_named_auto worldViewProj worldviewproj_matrix
|
---|
141 | }
|
---|
142 |
|
---|
143 | // Fragment program
|
---|
144 | fragment_program_ref Examples/BumpMapFP
|
---|
145 | {
|
---|
146 | param_named_auto lightDiffuse light_diffuse_colour 0
|
---|
147 | }
|
---|
148 |
|
---|
149 | // Base bump map
|
---|
150 | texture_unit
|
---|
151 | {
|
---|
152 | texture NMBumpsOut.png
|
---|
153 | colour_op replace
|
---|
154 | }
|
---|
155 | // Normalisation cube map
|
---|
156 | texture_unit
|
---|
157 | {
|
---|
158 | cubic_texture nm.png combinedUVW
|
---|
159 | tex_coord_set 1
|
---|
160 | tex_address_mode clamp
|
---|
161 | }
|
---|
162 | // Decal
|
---|
163 | texture_unit
|
---|
164 | {
|
---|
165 | texture RustySteel.jpg
|
---|
166 | }
|
---|
167 | }
|
---|
168 | }
|
---|
169 | // Fallback technique, uses vertex program but only fixed-function
|
---|
170 | // fragment shading, which does not support coloured light
|
---|
171 | technique
|
---|
172 | {
|
---|
173 | pass
|
---|
174 | {
|
---|
175 | // base colours, not needed for rendering, but as information
|
---|
176 | // to lighting pass categorisation routine
|
---|
177 | ambient 0 0 0
|
---|
178 | // Vertex program reference
|
---|
179 | vertex_program_ref Examples/BumpMapVP
|
---|
180 | {
|
---|
181 | param_named_auto lightPosition light_position_object_space 0
|
---|
182 | param_named_auto worldViewProj worldviewproj_matrix
|
---|
183 | }
|
---|
184 |
|
---|
185 | // Base bump map
|
---|
186 | texture_unit
|
---|
187 | {
|
---|
188 | texture NMBumpsOut.png
|
---|
189 | colour_op replace
|
---|
190 | }
|
---|
191 | // Normalisation cube map
|
---|
192 | texture_unit
|
---|
193 | {
|
---|
194 | cubic_texture nm.png combinedUVW
|
---|
195 | tex_coord_set 1
|
---|
196 | tex_address_mode clamp
|
---|
197 | colour_op_ex dotproduct src_texture src_current
|
---|
198 | colour_op_multipass_fallback dest_colour zero
|
---|
199 | }
|
---|
200 | // Decal
|
---|
201 | texture_unit
|
---|
202 | {
|
---|
203 | texture RustySteel.jpg
|
---|
204 | }
|
---|
205 | }
|
---|
206 | }
|
---|
207 | }
|
---|
208 |
|
---|
209 | // Any number of lights, diffuse
|
---|
210 | material Examples/BumpMapping/MultiLight
|
---|
211 | {
|
---|
212 |
|
---|
213 | // This is the preferred technique which uses both vertex and
|
---|
214 | // fragment programs, supports coloured lights
|
---|
215 | technique
|
---|
216 | {
|
---|
217 | // Base ambient pass
|
---|
218 | pass
|
---|
219 | {
|
---|
220 | // base colours, not needed for rendering, but as information
|
---|
221 | // to lighting pass categorisation routine
|
---|
222 | ambient 1 1 1
|
---|
223 | diffuse 0 0 0
|
---|
224 | specular 0 0 0 0
|
---|
225 | // Really basic vertex program
|
---|
226 | // NB we don't use fixed function here because GL does not like
|
---|
227 | // mixing fixed function and vertex programs, depth fighting can
|
---|
228 | // be an issue
|
---|
229 | vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture
|
---|
230 | {
|
---|
231 | param_named_auto worldViewProj worldviewproj_matrix
|
---|
232 | param_named_auto ambient ambient_light_colour
|
---|
233 | }
|
---|
234 |
|
---|
235 | }
|
---|
236 | // Now do the lighting pass
|
---|
237 | // NB we don't do decal texture here because this is repeated per light
|
---|
238 | pass
|
---|
239 | {
|
---|
240 | // base colours, not needed for rendering, but as information
|
---|
241 | // to lighting pass categorisation routine
|
---|
242 | ambient 0 0 0
|
---|
243 |
|
---|
244 | // do this for each light
|
---|
245 | iteration once_per_light
|
---|
246 |
|
---|
247 |
|
---|
248 | scene_blend add
|
---|
249 |
|
---|
250 | // Vertex program reference
|
---|
251 | vertex_program_ref Examples/BumpMapVP
|
---|
252 | {
|
---|
253 | param_named_auto lightPosition light_position_object_space 0
|
---|
254 | param_named_auto worldViewProj worldviewproj_matrix
|
---|
255 | }
|
---|
256 |
|
---|
257 | // Fragment program
|
---|
258 | fragment_program_ref Examples/BumpMapFP
|
---|
259 | {
|
---|
260 | param_named_auto lightDiffuse light_diffuse_colour 0
|
---|
261 | }
|
---|
262 |
|
---|
263 | // Base bump map
|
---|
264 | texture_unit
|
---|
265 | {
|
---|
266 | texture NMBumpsOut.png
|
---|
267 | colour_op replace
|
---|
268 | }
|
---|
269 | // Normalisation cube map
|
---|
270 | texture_unit
|
---|
271 | {
|
---|
272 | cubic_texture nm.png combinedUVW
|
---|
273 | tex_coord_set 1
|
---|
274 | tex_address_mode clamp
|
---|
275 | }
|
---|
276 | }
|
---|
277 |
|
---|
278 | // Decal pass
|
---|
279 | pass
|
---|
280 | {
|
---|
281 | // base colours, not needed for rendering, but as information
|
---|
282 | // to lighting pass categorisation routine
|
---|
283 | lighting off
|
---|
284 | // Really basic vertex program
|
---|
285 | // NB we don't use fixed function here because GL does not like
|
---|
286 | // mixing fixed function and vertex programs, depth fighting can
|
---|
287 | // be an issue
|
---|
288 | vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture
|
---|
289 | {
|
---|
290 | param_named_auto worldViewProj worldviewproj_matrix
|
---|
291 | param_named ambient float4 1 1 1 1
|
---|
292 | }
|
---|
293 | scene_blend dest_colour zero
|
---|
294 | texture_unit
|
---|
295 | {
|
---|
296 | texture RustedMetal.jpg
|
---|
297 | }
|
---|
298 |
|
---|
299 | }
|
---|
300 | }
|
---|
301 |
|
---|
302 | // This is the fallback which cards which don't have fragment program
|
---|
303 | // support will use
|
---|
304 | // Note that it still requires vertex program support
|
---|
305 | technique
|
---|
306 | {
|
---|
307 | // Base ambient pass
|
---|
308 | pass
|
---|
309 | {
|
---|
310 | // base colours, not needed for rendering, but as information
|
---|
311 | // to lighting pass categorisation routine
|
---|
312 | ambient 1 1 1
|
---|
313 | diffuse 0 0 0
|
---|
314 | specular 0 0 0 0
|
---|
315 | // Really basic vertex program
|
---|
316 | // NB we don't use fixed function here because GL does not like
|
---|
317 | // mixing fixed function and vertex programs, depth fighting can
|
---|
318 | // be an issue
|
---|
319 | vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture
|
---|
320 | {
|
---|
321 | param_named_auto worldViewProj worldviewproj_matrix
|
---|
322 | param_named_auto ambient ambient_light_colour
|
---|
323 | }
|
---|
324 |
|
---|
325 | }
|
---|
326 | // Now do the lighting pass
|
---|
327 | // NB we don't do decal texture here because this is repeated per light
|
---|
328 | pass
|
---|
329 | {
|
---|
330 | // base colours, not needed for rendering, but as information
|
---|
331 | // to lighting pass categorisation routine
|
---|
332 | ambient 0 0 0
|
---|
333 | // do this for each light
|
---|
334 | iteration once_per_light
|
---|
335 |
|
---|
336 |
|
---|
337 | scene_blend add
|
---|
338 |
|
---|
339 | // Vertex program reference
|
---|
340 | vertex_program_ref Examples/BumpMapVP
|
---|
341 | {
|
---|
342 | param_named_auto lightPosition light_position_object_space 0
|
---|
343 | param_named_auto worldViewProj worldviewproj_matrix
|
---|
344 | }
|
---|
345 |
|
---|
346 | // Base bump map
|
---|
347 | texture_unit
|
---|
348 | {
|
---|
349 | texture NMBumpsOut.png
|
---|
350 | colour_op replace
|
---|
351 | }
|
---|
352 | // Normalisation cube map, with dot product on bump map
|
---|
353 | texture_unit
|
---|
354 | {
|
---|
355 | cubic_texture nm.png combinedUVW
|
---|
356 | tex_coord_set 1
|
---|
357 | tex_address_mode clamp
|
---|
358 | colour_op_ex dotproduct src_texture src_current
|
---|
359 | colour_op_multipass_fallback dest_colour zero
|
---|
360 | }
|
---|
361 | }
|
---|
362 |
|
---|
363 | // Decal pass
|
---|
364 | pass
|
---|
365 | {
|
---|
366 | lighting off
|
---|
367 | // Really basic vertex program
|
---|
368 | // NB we don't use fixed function here because GL does not like
|
---|
369 | // mixing fixed function and vertex programs, depth fighting can
|
---|
370 | // be an issue
|
---|
371 | vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture
|
---|
372 | {
|
---|
373 | param_named_auto worldViewProj worldviewproj_matrix
|
---|
374 | param_named ambient float4 1 1 1 1
|
---|
375 | }
|
---|
376 | scene_blend dest_colour zero
|
---|
377 | texture_unit
|
---|
378 | {
|
---|
379 | texture RustedMetal.jpg
|
---|
380 | }
|
---|
381 |
|
---|
382 | }
|
---|
383 |
|
---|
384 | }
|
---|
385 | }
|
---|
386 |
|
---|
387 | // Any number of lights, diffuse and specular
|
---|
388 | material Examples/BumpMapping/MultiLightSpecular
|
---|
389 | {
|
---|
390 |
|
---|
391 | // This is the preferred technique which uses both vertex and
|
---|
392 | // fragment programs, supports coloured lights
|
---|
393 | technique
|
---|
394 | {
|
---|
395 | // Base ambient pass
|
---|
396 | pass
|
---|
397 | {
|
---|
398 | // base colours, not needed for rendering, but as information
|
---|
399 | // to lighting pass categorisation routine
|
---|
400 | ambient 1 1 1
|
---|
401 | diffuse 0 0 0
|
---|
402 | specular 0 0 0 0
|
---|
403 | // Really basic vertex program
|
---|
404 | // NB we don't use fixed function here because GL does not like
|
---|
405 | // mixing fixed function and vertex programs, depth fighting can
|
---|
406 | // be an issue
|
---|
407 | vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture
|
---|
408 | {
|
---|
409 | param_named_auto worldViewProj worldviewproj_matrix
|
---|
410 | param_named_auto ambient ambient_light_colour
|
---|
411 | }
|
---|
412 |
|
---|
413 | }
|
---|
414 | // Now do the lighting pass
|
---|
415 | // NB we don't do decal texture here because this is repeated per light
|
---|
416 | pass
|
---|
417 | {
|
---|
418 | // base colours, not needed for rendering, but as information
|
---|
419 | // to lighting pass categorisation routine
|
---|
420 | ambient 0 0 0
|
---|
421 | // do this for each light
|
---|
422 | iteration once_per_light
|
---|
423 |
|
---|
424 |
|
---|
425 | scene_blend add
|
---|
426 |
|
---|
427 | // Vertex program reference
|
---|
428 | vertex_program_ref Examples/BumpMapVPSpecular
|
---|
429 | {
|
---|
430 | param_named_auto lightPosition light_position_object_space 0
|
---|
431 | param_named_auto eyePosition camera_position_object_space
|
---|
432 | param_named_auto worldViewProj worldviewproj_matrix
|
---|
433 | }
|
---|
434 |
|
---|
435 | // Fragment program
|
---|
436 | fragment_program_ref Examples/BumpMapFPSpecular
|
---|
437 | {
|
---|
438 | param_named_auto lightDiffuse light_diffuse_colour 0
|
---|
439 | param_named_auto lightSpecular light_specular_colour 0
|
---|
440 | }
|
---|
441 |
|
---|
442 | // Base bump map
|
---|
443 | texture_unit
|
---|
444 | {
|
---|
445 | texture NMBumpsOut.png
|
---|
446 | colour_op replace
|
---|
447 | }
|
---|
448 | // Normalisation cube map
|
---|
449 | texture_unit
|
---|
450 | {
|
---|
451 | cubic_texture nm.png combinedUVW
|
---|
452 | tex_coord_set 1
|
---|
453 | tex_address_mode clamp
|
---|
454 | }
|
---|
455 | // Normalisation cube map #2
|
---|
456 | texture_unit
|
---|
457 | {
|
---|
458 | cubic_texture nm.png combinedUVW
|
---|
459 | tex_coord_set 2
|
---|
460 | tex_address_mode clamp
|
---|
461 | }
|
---|
462 | }
|
---|
463 |
|
---|
464 | // Decal pass
|
---|
465 | pass
|
---|
466 | {
|
---|
467 | lighting off
|
---|
468 | // Really basic vertex program
|
---|
469 | // NB we don't use fixed function here because GL does not like
|
---|
470 | // mixing fixed function and vertex programs, depth fighting can
|
---|
471 | // be an issue
|
---|
472 | vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture
|
---|
473 | {
|
---|
474 | param_named_auto worldViewProj worldviewproj_matrix
|
---|
475 | param_named ambient float4 1 1 1 1
|
---|
476 | }
|
---|
477 | scene_blend dest_colour zero
|
---|
478 | texture_unit
|
---|
479 | {
|
---|
480 | texture RustedMetal.jpg
|
---|
481 | }
|
---|
482 |
|
---|
483 | }
|
---|
484 | }
|
---|
485 |
|
---|
486 | // This is the fallback which cards which don't have fragment program
|
---|
487 | // support will use, NB does not support specular colour
|
---|
488 | // Note that it still requires vertex program support
|
---|
489 | technique
|
---|
490 | {
|
---|
491 | // Base ambient pass
|
---|
492 | pass
|
---|
493 | {
|
---|
494 | // base colours, not needed for rendering, but as information
|
---|
495 | // to lighting pass categorisation routine
|
---|
496 | ambient 1 1 1
|
---|
497 | diffuse 0 0 0
|
---|
498 | specular 0 0 0 0
|
---|
499 | // Really basic vertex program
|
---|
500 | // NB we don't use fixed function here because GL does not like
|
---|
501 | // mixing fixed function and vertex programs, depth fighting can
|
---|
502 | // be an issue
|
---|
503 | vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture
|
---|
504 | {
|
---|
505 | param_named_auto worldViewProj worldviewproj_matrix
|
---|
506 | param_named_auto ambient ambient_light_colour
|
---|
507 | }
|
---|
508 |
|
---|
509 | }
|
---|
510 | // Now do the lighting pass
|
---|
511 | // NB we don't do decal texture here because this is repeated per light
|
---|
512 | pass
|
---|
513 | {
|
---|
514 | // base colours, not needed for rendering, but as information
|
---|
515 | // to lighting pass categorisation routine
|
---|
516 | ambient 0 0 0
|
---|
517 | // do this for each light
|
---|
518 | iteration once_per_light
|
---|
519 |
|
---|
520 |
|
---|
521 | scene_blend add
|
---|
522 |
|
---|
523 | // Vertex program reference
|
---|
524 | vertex_program_ref Examples/BumpMapVP
|
---|
525 | {
|
---|
526 | param_named_auto lightPosition light_position_object_space 0
|
---|
527 | param_named_auto worldViewProj worldviewproj_matrix
|
---|
528 | }
|
---|
529 |
|
---|
530 | // Base bump map
|
---|
531 | texture_unit
|
---|
532 | {
|
---|
533 | texture NMBumpsOut.png
|
---|
534 | colour_op replace
|
---|
535 | }
|
---|
536 | // Normalisation cube map, with dot product on bump map
|
---|
537 | texture_unit
|
---|
538 | {
|
---|
539 | cubic_texture nm.png combinedUVW
|
---|
540 | tex_coord_set 1
|
---|
541 | tex_address_mode clamp
|
---|
542 | colour_op_ex dotproduct src_texture src_current
|
---|
543 | colour_op_multipass_fallback dest_colour zero
|
---|
544 | }
|
---|
545 | }
|
---|
546 |
|
---|
547 | // Decal pass
|
---|
548 | pass
|
---|
549 | {
|
---|
550 | lighting off
|
---|
551 | // Really basic vertex program
|
---|
552 | // NB we don't use fixed function here because GL does not like
|
---|
553 | // mixing fixed function and vertex programs, depth fighting can
|
---|
554 | // be an issue
|
---|
555 | vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture
|
---|
556 | {
|
---|
557 | param_named_auto worldViewProj worldviewproj_matrix
|
---|
558 | param_named ambient float4 1 1 1 1
|
---|
559 | }
|
---|
560 | scene_blend dest_colour zero
|
---|
561 | texture_unit
|
---|
562 | {
|
---|
563 | texture RustedMetal.jpg
|
---|
564 | }
|
---|
565 |
|
---|
566 | }
|
---|
567 |
|
---|
568 | }
|
---|
569 | }
|
---|
570 |
|
---|
571 | //---------------------------
|
---|
572 | // Projective texture section
|
---|
573 | //---------------------------
|
---|
574 |
|
---|
575 |
|
---|
576 | vertex_program Examples/TexProjectionVP cg
|
---|
577 | {
|
---|
578 | source Example_Projection.cg
|
---|
579 | entry_point generalPurposeProjection_vp
|
---|
580 | profiles vs_1_1 arbvp1
|
---|
581 | }
|
---|
582 |
|
---|
583 | fragment_program Examples/TexProjectionFP cg
|
---|
584 | {
|
---|
585 | source Example_Projection.cg
|
---|
586 | entry_point generalPurposeProjection_fp
|
---|
587 | // sorry, ps_1_1 can't do this, fp20 can though
|
---|
588 | profiles ps_2_0 arbfp1 fp20
|
---|
589 | }
|
---|
590 |
|
---|
591 | material Examples/GeneralTexProjection
|
---|
592 | {
|
---|
593 | technique
|
---|
594 | {
|
---|
595 | pass
|
---|
596 | {
|
---|
597 |
|
---|
598 | vertex_program_ref Examples/TexProjectionVP
|
---|
599 | {
|
---|
600 | param_named_auto worldViewProjMatrix worldviewproj_matrix
|
---|
601 | param_named_auto worldMatrix world_matrix
|
---|
602 | // You'll need to update the tex projection, I suggest using
|
---|
603 | // the Frustum class
|
---|
604 | //param_named_auto texWorldViewProj worldviewproj_matrix
|
---|
605 | }
|
---|
606 | fragment_program_ref Examples/TexProjectionFP
|
---|
607 | {
|
---|
608 | // no params
|
---|
609 | }
|
---|
610 | texture_unit
|
---|
611 | {
|
---|
612 | // Project the OGRE logo
|
---|
613 | texture ogrelogo.png
|
---|
614 | tex_address_mode clamp
|
---|
615 | }
|
---|
616 | }
|
---|
617 |
|
---|
618 |
|
---|
619 | }
|
---|
620 |
|
---|
621 | }
|
---|
622 |
|
---|
623 | //----------------------------
|
---|
624 | // Distortion effects
|
---|
625 | //----------------------------
|
---|
626 |
|
---|
627 | vertex_program Examples/FresnelRefractReflectVP cg
|
---|
628 | {
|
---|
629 | source Example_Fresnel.cg
|
---|
630 | entry_point main_vp
|
---|
631 | profiles vs_1_1 arbvp1
|
---|
632 | }
|
---|
633 |
|
---|
634 | fragment_program Examples/FresnelRefractReflectFP cg
|
---|
635 | {
|
---|
636 | source Example_Fresnel.cg
|
---|
637 | entry_point main_fp
|
---|
638 | // sorry, ps_1_1 and fp20 can't do this
|
---|
639 | profiles ps_2_0 arbfp1
|
---|
640 | }
|
---|
641 |
|
---|
642 | fragment_program Examples/FresnelRefractReflectPS asm
|
---|
643 | {
|
---|
644 | source Example_FresnelPS.asm
|
---|
645 | // sorry, only for ps_1_4 :)
|
---|
646 | syntax ps_1_4
|
---|
647 |
|
---|
648 | }
|
---|
649 |
|
---|
650 | material Examples/FresnelReflectionRefraction
|
---|
651 | {
|
---|
652 | // ps_2_0 / arbfp1
|
---|
653 | technique
|
---|
654 | {
|
---|
655 | pass
|
---|
656 | {
|
---|
657 |
|
---|
658 | vertex_program_ref Examples/FresnelRefractReflectVP
|
---|
659 | {
|
---|
660 | param_named_auto worldViewProjMatrix worldviewproj_matrix
|
---|
661 | param_named_auto eyePosition camera_position_object_space
|
---|
662 | param_named fresnelBias float -0.3
|
---|
663 | param_named fresnelScale float 1.4
|
---|
664 | param_named fresnelPower float 8
|
---|
665 | param_named_auto timeVal time 0.05
|
---|
666 | param_named scroll float 1
|
---|
667 | param_named scale float 4
|
---|
668 | param_named noise float 1
|
---|
669 | // scroll and noisePos will need updating per frame
|
---|
670 | }
|
---|
671 | fragment_program_ref Examples/FresnelRefractReflectFP
|
---|
672 | {
|
---|
673 | param_named distortionRange float 0.025
|
---|
674 | param_named tintColour float4 0 0 0 1
|
---|
675 | }
|
---|
676 | // Noise
|
---|
677 | texture_unit
|
---|
678 | {
|
---|
679 | // Perlin noise volume
|
---|
680 | texture perlinvolume.dds 3d
|
---|
681 | // min / mag filtering, no mip
|
---|
682 | filtering linear linear none
|
---|
683 | }
|
---|
684 | // Reflection
|
---|
685 | texture_unit
|
---|
686 | {
|
---|
687 | // Will be filled in at runtime
|
---|
688 | texture Reflection
|
---|
689 | tex_address_mode clamp
|
---|
690 | // needed by ps.1.4
|
---|
691 | tex_coord_set 1
|
---|
692 | }
|
---|
693 | // Refraction
|
---|
694 | texture_unit
|
---|
695 | {
|
---|
696 | // Will be filled in at runtime
|
---|
697 | texture Refraction
|
---|
698 | tex_address_mode clamp
|
---|
699 | // needed by ps.1.4
|
---|
700 | tex_coord_set 2
|
---|
701 | }
|
---|
702 | }
|
---|
703 |
|
---|
704 |
|
---|
705 | }
|
---|
706 |
|
---|
707 | // ATI 8500 +
|
---|
708 | technique
|
---|
709 | {
|
---|
710 | pass
|
---|
711 | {
|
---|
712 | vertex_program_ref Examples/FresnelRefractReflectVP
|
---|
713 | {
|
---|
714 | param_named_auto worldViewProjMatrix worldviewproj_matrix
|
---|
715 | param_named_auto eyePosition camera_position_object_space
|
---|
716 | param_named fresnelBias float -0.3
|
---|
717 | param_named fresnelScale float 1.4
|
---|
718 | param_named fresnelPower float 8
|
---|
719 | param_named_auto timeVal time 0.05
|
---|
720 | param_named scroll float 1
|
---|
721 | param_named scale float 4
|
---|
722 | param_named noise float 1
|
---|
723 | // scroll and noisePos will need updating per frame
|
---|
724 | }
|
---|
725 |
|
---|
726 | // for ATI RADEON 8500 - 9200
|
---|
727 | fragment_program_ref Examples/FresnelRefractReflectPS
|
---|
728 | {
|
---|
729 | // distortionRange
|
---|
730 | param_indexed 0 float 0.025
|
---|
731 | // tintColour
|
---|
732 | param_indexed 1 float4 0.05 0.12 0.15 1
|
---|
733 | }
|
---|
734 |
|
---|
735 | // Noise
|
---|
736 | texture_unit
|
---|
737 | {
|
---|
738 | // Perlin noise volume
|
---|
739 | texture perlinvolume.dds 3d
|
---|
740 | // min / mag filtering, no mip
|
---|
741 | filtering linear linear none
|
---|
742 | }
|
---|
743 | // Reflection
|
---|
744 | texture_unit
|
---|
745 | {
|
---|
746 | // Will be filled in at runtime
|
---|
747 | texture Reflection
|
---|
748 | tex_address_mode clamp
|
---|
749 | // needed by ps.1.4
|
---|
750 | tex_coord_set 1
|
---|
751 | }
|
---|
752 | // Refraction
|
---|
753 | texture_unit
|
---|
754 | {
|
---|
755 | // Will be filled in at runtime
|
---|
756 | texture Refraction
|
---|
757 | tex_address_mode clamp
|
---|
758 | // needed by ps.1.4
|
---|
759 | tex_coord_set 2
|
---|
760 | }
|
---|
761 | }
|
---|
762 | }
|
---|
763 | }
|
---|
764 |
|
---|
765 | // Normal-mapped Athene statue
|
---|
766 | material Examples/Athene/NormalMapped
|
---|
767 | {
|
---|
768 |
|
---|
769 | // This is the preferred technique which uses both vertex and
|
---|
770 | // fragment programs, supports coloured lights
|
---|
771 | technique
|
---|
772 | {
|
---|
773 | // Base ambient pass
|
---|
774 | pass
|
---|
775 | {
|
---|
776 | // base colours, not needed for rendering, but as information
|
---|
777 | // to lighting pass categorisation routine
|
---|
778 | ambient 1 1 1
|
---|
779 | diffuse 0 0 0
|
---|
780 | specular 0 0 0 0
|
---|
781 | // Really basic vertex program
|
---|
782 | // NB we don't use fixed function here because GL does not like
|
---|
783 | // mixing fixed function and vertex programs, depth fighting can
|
---|
784 | // be an issue
|
---|
785 | vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture
|
---|
786 | {
|
---|
787 | param_named_auto worldViewProj worldviewproj_matrix
|
---|
788 | param_named_auto ambient ambient_light_colour
|
---|
789 | }
|
---|
790 |
|
---|
791 | }
|
---|
792 | // Now do the lighting pass
|
---|
793 | // NB we don't do decal texture here because this is repeated per light
|
---|
794 | pass
|
---|
795 | {
|
---|
796 | // base colours, not needed for rendering, but as information
|
---|
797 | // to lighting pass categorisation routine
|
---|
798 | ambient 0 0 0
|
---|
799 |
|
---|
800 | // do this for each light
|
---|
801 | iteration once_per_light
|
---|
802 |
|
---|
803 |
|
---|
804 | scene_blend add
|
---|
805 |
|
---|
806 | // Vertex program reference
|
---|
807 | vertex_program_ref Examples/BumpMapVP
|
---|
808 | {
|
---|
809 | param_named_auto lightPosition light_position_object_space 0
|
---|
810 | param_named_auto worldViewProj worldviewproj_matrix
|
---|
811 | }
|
---|
812 |
|
---|
813 | // Fragment program
|
---|
814 | fragment_program_ref Examples/BumpMapFP
|
---|
815 | {
|
---|
816 | param_named_auto lightDiffuse light_diffuse_colour 0
|
---|
817 | }
|
---|
818 |
|
---|
819 | // texture shadow receiver program
|
---|
820 | shadow_receiver_vertex_program_ref Examples/BumpMapVPShadowRcv
|
---|
821 | {
|
---|
822 | param_named_auto lightPosition light_position_object_space 0
|
---|
823 | param_named_auto worldViewProj worldviewproj_matrix
|
---|
824 | param_named_auto worldMatrix world_matrix
|
---|
825 | param_named_auto texViewProj texture_viewproj_matrix
|
---|
826 | }
|
---|
827 | // Additive texture shadow receiver program
|
---|
828 | shadow_receiver_fragment_program_ref Examples/BumpMapFPShadowRcv
|
---|
829 | {
|
---|
830 | param_named_auto lightDiffuse light_diffuse_colour 0
|
---|
831 | }
|
---|
832 |
|
---|
833 | // Base bump map
|
---|
834 | texture_unit
|
---|
835 | {
|
---|
836 | texture atheneNormalMap.png
|
---|
837 | colour_op replace
|
---|
838 | }
|
---|
839 | // Normalisation cube map
|
---|
840 | texture_unit
|
---|
841 | {
|
---|
842 | cubic_texture nm.png combinedUVW
|
---|
843 | tex_coord_set 1
|
---|
844 | tex_address_mode clamp
|
---|
845 | }
|
---|
846 | }
|
---|
847 |
|
---|
848 | // Decal pass
|
---|
849 | pass
|
---|
850 | {
|
---|
851 | // base colours, not needed for rendering, but as information
|
---|
852 | // to lighting pass categorisation routine
|
---|
853 | lighting off
|
---|
854 | // Really basic vertex program
|
---|
855 | // NB we don't use fixed function here because GL does not like
|
---|
856 | // mixing fixed function and vertex programs, depth fighting can
|
---|
857 | // be an issue
|
---|
858 | vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture
|
---|
859 | {
|
---|
860 | param_named_auto worldViewProj worldviewproj_matrix
|
---|
861 | param_named ambient float4 1 1 1 1
|
---|
862 | }
|
---|
863 | scene_blend dest_colour zero
|
---|
864 | texture_unit
|
---|
865 | {
|
---|
866 | texture egyptrockyfull.jpg
|
---|
867 | }
|
---|
868 |
|
---|
869 | }
|
---|
870 | }
|
---|
871 |
|
---|
872 | // This is the fallback which cards which don't have fragment program
|
---|
873 | // support will use
|
---|
874 | // Note that it still requires vertex program support
|
---|
875 | technique
|
---|
876 | {
|
---|
877 | // Base ambient pass
|
---|
878 | pass
|
---|
879 | {
|
---|
880 | // base colours, not needed for rendering, but as information
|
---|
881 | // to lighting pass categorisation routine
|
---|
882 | ambient 1 1 1
|
---|
883 | diffuse 0 0 0
|
---|
884 | specular 0 0 0 0
|
---|
885 | // Really basic vertex program
|
---|
886 | // NB we don't use fixed function here because GL does not like
|
---|
887 | // mixing fixed function and vertex programs, depth fighting can
|
---|
888 | // be an issue
|
---|
889 | vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture
|
---|
890 | {
|
---|
891 | param_named_auto worldViewProj worldviewproj_matrix
|
---|
892 | param_named_auto ambient ambient_light_colour
|
---|
893 | }
|
---|
894 |
|
---|
895 | }
|
---|
896 | // Now do the lighting pass
|
---|
897 | // NB we don't do decal texture here because this is repeated per light
|
---|
898 | pass
|
---|
899 | {
|
---|
900 | // base colours, not needed for rendering, but as information
|
---|
901 | // to lighting pass categorisation routine
|
---|
902 | ambient 0 0 0
|
---|
903 | // do this for each light
|
---|
904 | iteration once_per_light
|
---|
905 |
|
---|
906 |
|
---|
907 | scene_blend add
|
---|
908 |
|
---|
909 | // Vertex program reference
|
---|
910 | vertex_program_ref Examples/BumpMapVP
|
---|
911 | {
|
---|
912 | param_named_auto lightPosition light_position_object_space 0
|
---|
913 | param_named_auto worldViewProj worldviewproj_matrix
|
---|
914 | }
|
---|
915 |
|
---|
916 | // Base bump map
|
---|
917 | texture_unit
|
---|
918 | {
|
---|
919 | texture atheneNormalMap.png
|
---|
920 | colour_op replace
|
---|
921 | }
|
---|
922 | // Normalisation cube map, with dot product on bump map
|
---|
923 | texture_unit
|
---|
924 | {
|
---|
925 | cubic_texture nm.png combinedUVW
|
---|
926 | tex_coord_set 1
|
---|
927 | tex_address_mode clamp
|
---|
928 | colour_op_ex dotproduct src_texture src_current
|
---|
929 | colour_op_multipass_fallback dest_colour zero
|
---|
930 | }
|
---|
931 | }
|
---|
932 |
|
---|
933 | // Decal pass
|
---|
934 | pass
|
---|
935 | {
|
---|
936 | lighting off
|
---|
937 | // Really basic vertex program
|
---|
938 | // NB we don't use fixed function here because GL does not like
|
---|
939 | // mixing fixed function and vertex programs, depth fighting can
|
---|
940 | // be an issue
|
---|
941 | vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture
|
---|
942 | {
|
---|
943 | param_named_auto worldViewProj worldviewproj_matrix
|
---|
944 | param_named ambient float4 1 1 1 1
|
---|
945 | }
|
---|
946 | scene_blend dest_colour zero
|
---|
947 | texture_unit
|
---|
948 | {
|
---|
949 | texture egyptrockyfull.jpg
|
---|
950 | }
|
---|
951 |
|
---|
952 | }
|
---|
953 |
|
---|
954 | }
|
---|
955 | }
|
---|
956 |
|
---|
957 | // Basic Athene statue
|
---|
958 | material Examples/Athene/Basic
|
---|
959 | {
|
---|
960 |
|
---|
961 | technique
|
---|
962 | {
|
---|
963 | pass
|
---|
964 | {
|
---|
965 | ambient 0.3 0.3 0.3
|
---|
966 | diffuse 1.0 1.0 0.9
|
---|
967 |
|
---|
968 | texture_unit
|
---|
969 | {
|
---|
970 | texture egyptrockyfull.jpg
|
---|
971 | }
|
---|
972 |
|
---|
973 | }
|
---|
974 | }
|
---|
975 | }
|
---|
976 |
|
---|
977 |
|
---|
978 | // Any number of lights, diffuse and specular
|
---|
979 | material Examples/Athene/NormalMappedSpecular
|
---|
980 | {
|
---|
981 |
|
---|
982 | // This is the preferred technique which uses both vertex and
|
---|
983 | // fragment programs, supports coloured lights
|
---|
984 | technique
|
---|
985 | {
|
---|
986 | // Base ambient pass
|
---|
987 | pass
|
---|
988 | {
|
---|
989 | // base colours, not needed for rendering, but as information
|
---|
990 | // to lighting pass categorisation routine
|
---|
991 | ambient 1 1 1
|
---|
992 | diffuse 0 0 0
|
---|
993 | specular 0 0 0 0
|
---|
994 | // Really basic vertex program
|
---|
995 | // NB we don't use fixed function here because GL does not like
|
---|
996 | // mixing fixed function and vertex programs, depth fighting can
|
---|
997 | // be an issue
|
---|
998 | vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture
|
---|
999 | {
|
---|
1000 | param_named_auto worldViewProj worldviewproj_matrix
|
---|
1001 | param_named_auto ambient ambient_light_colour
|
---|
1002 | }
|
---|
1003 |
|
---|
1004 | }
|
---|
1005 | // Now do the lighting pass
|
---|
1006 | // NB we don't do decal texture here because this is repeated per light
|
---|
1007 | pass
|
---|
1008 | {
|
---|
1009 | // base colours, not needed for rendering, but as information
|
---|
1010 | // to lighting pass categorisation routine
|
---|
1011 | ambient 0 0 0
|
---|
1012 | // do this for each light
|
---|
1013 | iteration once_per_light
|
---|
1014 |
|
---|
1015 |
|
---|
1016 | scene_blend add
|
---|
1017 |
|
---|
1018 | // Vertex program reference
|
---|
1019 | vertex_program_ref Examples/BumpMapVPSpecular
|
---|
1020 | {
|
---|
1021 | param_named_auto lightPosition light_position_object_space 0
|
---|
1022 | param_named_auto eyePosition camera_position_object_space
|
---|
1023 | param_named_auto worldViewProj worldviewproj_matrix
|
---|
1024 | }
|
---|
1025 |
|
---|
1026 | // Fragment program
|
---|
1027 | fragment_program_ref Examples/BumpMapFPSpecular
|
---|
1028 | {
|
---|
1029 | param_named_auto lightDiffuse light_diffuse_colour 0
|
---|
1030 | param_named_auto lightSpecular light_specular_colour 0
|
---|
1031 | }
|
---|
1032 |
|
---|
1033 | // Base bump map
|
---|
1034 | texture_unit
|
---|
1035 | {
|
---|
1036 | texture atheneNormalMap.png
|
---|
1037 | colour_op replace
|
---|
1038 | }
|
---|
1039 | // Normalisation cube map
|
---|
1040 | texture_unit
|
---|
1041 | {
|
---|
1042 | cubic_texture nm.png combinedUVW
|
---|
1043 | tex_coord_set 1
|
---|
1044 | tex_address_mode clamp
|
---|
1045 | }
|
---|
1046 | // Normalisation cube map #2
|
---|
1047 | texture_unit
|
---|
1048 | {
|
---|
1049 | cubic_texture nm.png combinedUVW
|
---|
1050 | tex_coord_set 2
|
---|
1051 | tex_address_mode clamp
|
---|
1052 | }
|
---|
1053 | }
|
---|
1054 |
|
---|
1055 | // Decal pass
|
---|
1056 | pass
|
---|
1057 | {
|
---|
1058 | lighting off
|
---|
1059 | // Really basic vertex program
|
---|
1060 | // NB we don't use fixed function here because GL does not like
|
---|
1061 | // mixing fixed function and vertex programs, depth fighting can
|
---|
1062 | // be an issue
|
---|
1063 | vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture
|
---|
1064 | {
|
---|
1065 | param_named_auto worldViewProj worldviewproj_matrix
|
---|
1066 | param_named ambient float4 1 1 1 1
|
---|
1067 | }
|
---|
1068 | scene_blend dest_colour zero
|
---|
1069 | texture_unit
|
---|
1070 | {
|
---|
1071 | texture egyptrockyfull.jpg
|
---|
1072 | }
|
---|
1073 |
|
---|
1074 | }
|
---|
1075 | }
|
---|
1076 |
|
---|
1077 | // This is the fallback which cards which don't have fragment program
|
---|
1078 | // support will use, NB does not support specular colour
|
---|
1079 | // Note that it still requires vertex program support
|
---|
1080 | technique
|
---|
1081 | {
|
---|
1082 | // Base ambient pass
|
---|
1083 | pass
|
---|
1084 | {
|
---|
1085 | // base colours, not needed for rendering, but as information
|
---|
1086 | // to lighting pass categorisation routine
|
---|
1087 | ambient 1 1 1
|
---|
1088 | diffuse 0 0 0
|
---|
1089 | specular 0 0 0 0
|
---|
1090 | // Really basic vertex program
|
---|
1091 | // NB we don't use fixed function here because GL does not like
|
---|
1092 | // mixing fixed function and vertex programs, depth fighting can
|
---|
1093 | // be an issue
|
---|
1094 | vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture
|
---|
1095 | {
|
---|
1096 | param_named_auto worldViewProj worldviewproj_matrix
|
---|
1097 | param_named_auto ambient ambient_light_colour
|
---|
1098 | }
|
---|
1099 |
|
---|
1100 | }
|
---|
1101 | // Now do the lighting pass
|
---|
1102 | // NB we don't do decal texture here because this is repeated per light
|
---|
1103 | pass
|
---|
1104 | {
|
---|
1105 | // base colours, not needed for rendering, but as information
|
---|
1106 | // to lighting pass categorisation routine
|
---|
1107 | ambient 0 0 0
|
---|
1108 | // do this for each light
|
---|
1109 | iteration once_per_light
|
---|
1110 |
|
---|
1111 |
|
---|
1112 | scene_blend add
|
---|
1113 |
|
---|
1114 | // Vertex program reference
|
---|
1115 | vertex_program_ref Examples/BumpMapVP
|
---|
1116 | {
|
---|
1117 | param_named_auto lightPosition light_position_object_space 0
|
---|
1118 | param_named_auto worldViewProj worldviewproj_matrix
|
---|
1119 | }
|
---|
1120 |
|
---|
1121 | // Base bump map
|
---|
1122 | texture_unit
|
---|
1123 | {
|
---|
1124 | texture atheneNormalMap.png
|
---|
1125 | colour_op replace
|
---|
1126 | }
|
---|
1127 | // Normalisation cube map, with dot product on bump map
|
---|
1128 | texture_unit
|
---|
1129 | {
|
---|
1130 | cubic_texture nm.png combinedUVW
|
---|
1131 | tex_coord_set 1
|
---|
1132 | tex_address_mode clamp
|
---|
1133 | colour_op_ex dotproduct src_texture src_current
|
---|
1134 | colour_op_multipass_fallback dest_colour zero
|
---|
1135 | }
|
---|
1136 | }
|
---|
1137 |
|
---|
1138 | // Decal pass
|
---|
1139 | pass
|
---|
1140 | {
|
---|
1141 | lighting off
|
---|
1142 | // Really basic vertex program
|
---|
1143 | // NB we don't use fixed function here because GL does not like
|
---|
1144 | // mixing fixed function and vertex programs, depth fighting can
|
---|
1145 | // be an issue
|
---|
1146 | vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture
|
---|
1147 | {
|
---|
1148 | param_named_auto worldViewProj worldviewproj_matrix
|
---|
1149 | param_named ambient float4 1 1 1 1
|
---|
1150 | }
|
---|
1151 | scene_blend dest_colour zero
|
---|
1152 | texture_unit
|
---|
1153 | {
|
---|
1154 | texture egyptrockyfull.jpg
|
---|
1155 | }
|
---|
1156 |
|
---|
1157 | }
|
---|
1158 |
|
---|
1159 | }
|
---|
1160 | }
|
---|
1161 |
|
---|