Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/hud/Media/materials/scripts/Examples.compositor @ 284

Last change on this file since 284 was 284, checked in by rgrieder, 16 years ago
  • added the necessary media material for the overlay
  • adjustd the resources.cfg file
File size: 13.3 KB
Line 
1// Manuel's bloom
2// Needs a scene-sized rtt, but does only one render of the scene
3compositor Bloom
4{
5    technique
6    {
7        // Temporary textures
8        texture rt0 128 128 PF_A8R8G8B8
9        texture rt1 128 128 PF_A8R8G8B8
10
11        target rt1
12        {
13            // Render output from previous compositor (or original scene)
14            input previous
15        }
16
17        target rt0
18        {
19            // Start with clear texture
20            input none
21            // Vertical blur pass
22            pass render_quad
23            {
24                // Renders a fullscreen quad with a material
25                material Ogre/Compositor/Blur0
26                input 0 rt1
27            }
28        }
29
30        target rt1
31        {
32            // Start with clear texture
33            input none
34            // Horizontal blur pass
35            pass render_quad
36            {
37                // Renders a fullscreen quad with a material
38                material Ogre/Compositor/Blur1
39                input 0 rt0
40            }
41        }
42
43        target_output
44        {
45            // Start with clear output
46            input previous
47            // Draw a fullscreen quad
48            pass render_quad
49            {
50                // Renders a fullscreen quad with a material
51                material Ogre/Compositor/BloomBlend
52                input 0 rt1
53            }
54        }
55    }
56}
57
58compositor Glass
59{
60    technique
61    {
62        texture rt0 target_width target_height PF_R8G8B8
63
64        target rt0 { input previous }
65
66        target_output
67        {
68            // Start with clear output
69            input none
70
71            pass render_quad
72            {
73                material Ogre/Compositor/GlassPass
74                input 0 rt0
75            }
76        }
77    }
78}
79
80compositor "Old TV"
81{
82    technique
83    {
84        texture rt0 target_width target_height PF_R8G8B8
85
86        // render scene to a texture
87        target rt0 { input previous }
88
89        target_output
90        {
91            // Start with clear output
92            input none
93
94            pass render_quad
95            {
96                // convert the previous render target to a black and white image, add some noise, distort it,
97                // then render to scene aligned quad
98                material Ogre/Compositor/OldTV
99                input 0 rt0
100            }
101        }
102    }
103}
104
105
106// Black and white effect
107compositor B&W
108{
109    technique
110    {
111        // Temporary textures
112        texture rt0 target_width target_height PF_A8R8G8B8
113
114        target rt0
115        {
116            // Render output from previous compositor (or original scene)
117            input previous
118        }
119
120        target_output
121        {
122            // Start with clear output
123            input none
124            // Draw a fullscreen quad with the black and white image
125            pass render_quad
126            {
127                // Renders a fullscreen quad with a material
128                material Ogre/Compositor/BlackAndWhite
129                input 0 rt0
130            }
131        }
132    }
133}
134
135//compositor DOF // based on Blur but final pass does depth of field
136//{
137//    technique
138//    {
139//        // Temporary textures
140//        texture rt0 target_width target_height PF_A8R8G8B8
141//        texture rt1 target_width target_height PF_A8R8G8B8
142//
143//        target rt1
144//        {
145//            // Render output from previous compositor (or original scene)
146//            input previous
147//        }
148//
149//        target rt0
150//        {
151//            // Start with clear texture
152//            input none
153//            // Vertical blur pass
154//            pass render_quad
155//            {
156//                // Renders a fullscreen quad with a material
157//                material Ogre/Compositor/DOF_Blur0
158//                input 0 rt1
159//            }
160//        }
161//
162//        target rt1
163//        {
164//            // Start with clear texture
165//            input none
166//            // Horizontal blur pass
167//            pass render_quad
168//            {
169//                // Renders a fullscreen quad with a material
170//                material Ogre/Compositor/DOF_Blur1
171//                input 0 rt0
172//            }
173//        }
174//
175//        target_output
176//        {
177//            // Start with clear output
178//            input none
179//            // Draw a fullscreen quad
180//            pass render_quad
181//            {
182//                // Renders a fullscreen quad with a material
183//                material Ogre/Compositor/DOF_Blend
184//                input 0 rt0
185//                input 1 rt1
186//            }
187//        }
188//    }
189//}
190
191// Embossed (fake bump) effect
192compositor Embossed
193{
194    technique
195    {
196        // Temporary textures
197        texture rt0 target_width target_height PF_A8R8G8B8
198
199        target rt0
200        {
201            // Render output from previous compositor (or original scene)
202            input previous
203        }
204
205        target_output
206        {
207            // Start with clear output
208            input none
209            // Draw a fullscreen quad with the black and white image
210            pass render_quad
211            {
212                // Renders a fullscreen quad with a material
213                material Ogre/Compositor/Embossed
214                input 0 rt0
215            }
216        }
217    }
218}
219
220// SharpenEdges
221compositor Sharpen Edges
222{
223    technique
224    {
225        // Temporary textures
226        texture rt0 target_width target_height PF_A8R8G8B8
227
228        target rt0
229        {
230            // Render output from previous compositor (or original scene)
231            input previous
232        }
233
234        target_output
235        {
236            // Start with clear output
237            input none
238            // Draw a fullscreen quad with the black and white image
239            pass render_quad
240            {
241                // Renders a fullscreen quad with a material
242                material Ogre/Compositor/SharpenEdges
243                input 0 rt0
244            }
245        }
246    }
247}
248
249// Invert
250compositor Invert
251{
252    technique
253    {
254        // Temporary textures
255        texture rt0 target_width target_height PF_A8R8G8B8
256
257        target rt0
258        {
259            // Render output from previous compositor (or original scene)
260            input previous
261        }
262
263        target_output
264        {
265            // Start with clear output
266            input none
267            // Draw a fullscreen quad with the black and white image
268            pass render_quad
269            {
270                // Renders a fullscreen quad with a material
271                material Ogre/Compositor/Invert
272                input 0 rt0
273            }
274        }
275    }
276}
277
278// Posterize
279compositor Posterize
280{
281    technique
282    {
283        // Temporary textures
284        texture rt0 target_width target_height PF_A8R8G8B8
285
286        target rt0
287        {
288            // Render output from previous compositor (or original scene)
289            input previous
290        }
291
292        target_output
293        {
294            // Start with clear output
295            input none
296            // Draw a fullscreen quad with the black and white image
297            pass render_quad
298            {
299                // Renders a fullscreen quad with a material
300                material Ogre/Compositor/Posterize
301                input 0 rt0
302            }
303        }
304    }
305}
306
307// Laplace
308compositor Laplace
309{
310    technique
311    {
312        // Temporary textures
313        texture rt0 target_width target_height PF_A8R8G8B8
314
315        target rt0
316        {
317            // Render output from previous compositor (or original scene)
318            input previous
319        }
320
321        target_output
322        {
323            // Start with clear output
324            input none
325            // Draw a fullscreen quad with the black and white image
326            pass render_quad
327            {
328                // Renders a fullscreen quad with a material
329                material Ogre/Compositor/Laplace
330                input 0 rt0
331            }
332        }
333    }
334}
335
336// Tiling
337compositor Tiling
338{
339    technique
340    {
341        // Temporary textures
342        texture rt0 target_width target_height PF_A8R8G8B8
343
344        target rt0
345        {
346            // Render output from previous compositor (or original scene)
347            input previous
348        }
349
350        target_output
351        {
352            // Start with clear output
353            input none
354            // Draw a fullscreen quad with the black and white image
355            pass render_quad
356            {
357                // Renders a fullscreen quad with a material
358                material Ogre/Compositor/Tiling
359                input 0 rt0
360            }
361        }
362    }
363}
364
365// Old Movie
366compositor Old Movie
367{
368    technique
369    {
370        // Temporary textures
371        texture rt0 target_width target_height PF_A8R8G8B8
372
373        target rt0
374        {
375            // Render output from previous compositor (or original scene)
376            input previous
377        }
378
379        target_output
380        {
381            // Start with clear output
382            input none
383            // Draw a fullscreen quad with the black and white image
384            pass render_quad
385            {
386                // Renders a fullscreen quad with a material
387                material Ogre/Compositor/OldMovie
388                input 0 rt0
389            }
390        }
391    }
392}
393
394// HDR
395compositor HDR
396{
397        // floating point only for now
398        technique
399        {
400        // Temporary textures
401                // Fullsize HDR render target, used as tone mapping source
402        texture rt_full target_width target_height PF_FLOAT16_RGB
403                // Targets used for luminance evaluation (3x3 downsample, point filtering)
404                texture rt_lum0 1 1 PF_FLOAT16_RGB
405                texture rt_lum1 4 4 PF_FLOAT16_RGB
406                texture rt_lum2 16 16 PF_FLOAT16_RGB
407                texture rt_lum3 64 64 PF_FLOAT16_RGB
408                texture rt_lum4 128 128 PF_FLOAT16_RGB
409                // Bright-pass filtered target (tone mapped)
410                texture rt_brightpass 128 128 PF_R8G8B8
411                // Bloom filter targets
412                texture rt_bloom0 128 128 PF_R8G8B8
413                texture rt_bloom1 128 128 PF_R8G8B8
414
415
416                target rt_full
417                {
418                        // No input, render differently
419                        input none
420
421                        // Use float target HDR material scheme (unclamped shaders)
422                        material_scheme HDR
423
424                        pass clear
425                        {
426                        }
427
428                        pass render_scene
429                        {
430                        }
431
432                }
433
434                // Downsample the original HDR scene to extract luminence value
435                target rt_lum4
436                {
437            input none
438            pass render_quad
439            {
440                // Downsample using a 2x2 filter and convert to greyscale
441                material Ogre/Compositor/HDR/Downsample2x2Luminence
442                input 0 rt_full
443                identifier 994
444            }
445                }
446                target rt_lum3
447                {
448            input none
449            pass render_quad
450            {
451                                // Downsample using a 3x3 filter
452                material Ogre/Compositor/HDR/Downsample3x3
453                input 0 rt_lum4
454                identifier 993
455            }
456                }
457                target rt_lum2
458                {
459            input none
460            pass render_quad
461            {
462                // Downsample using a 3x3 filter
463                material Ogre/Compositor/HDR/Downsample3x3
464                input 0 rt_lum3
465                identifier 992
466            }
467                }
468                target rt_lum1
469                {
470            input none
471            pass render_quad
472            {
473                // Downsample using a 3x3 filter
474                material Ogre/Compositor/HDR/Downsample3x3
475                input 0 rt_lum2
476                identifier 991
477            }
478                }
479                target rt_lum0
480                {
481            input none
482            pass render_quad
483            {
484                // Downsample using a 3x3 filter
485                material Ogre/Compositor/HDR/Downsample3x3
486                input 0 rt_lum1
487                identifier 990
488            }
489                }
490
491
492                target rt_brightpass
493                {
494            input none
495            pass render_quad
496            {
497                // Downsample using a 3x3 filter, hi-pass and tone map
498                material Ogre/Compositor/HDR/Downsample3x3Brightpass
499                input 0 rt_full
500                        input 1 rt_lum0
501                                identifier 800
502            }
503                }
504
505                target rt_bloom1
506                {
507                        input none
508                        pass render_quad
509                        {
510                                // Blur horizontally
511                                material Ogre/Compositor/HDR/GaussianBloom
512                                input 0 rt_brightpass
513                                identifier 701
514                        }
515                }
516                target rt_bloom0
517                {
518                        input none
519                        pass render_quad
520                        {
521                                // Blur horizontally
522                                material Ogre/Compositor/HDR/GaussianBloom
523                                input 0 rt_bloom1
524                                identifier 700
525                        }
526                }
527
528
529                // Final output combines tone mapping of the original scene, with an
530                // exposure setting passed in as a GPU parameter, and an additive bloom
531                // effect
532                target_output
533                {
534                        input none
535                        pass render_quad
536                        {
537                                material Ogre/Compositor/HDR/ToneMapping
538                                input 0 rt_full
539                                input 1 rt_bloom0
540                                input 2 rt_lum0
541                        }
542                }
543
544
545        }
546
547}
548
549
550// Gaussian blur effect
551compositor Gaussian Blur
552{
553    technique
554    {
555        // Temporary textures
556        texture rt0 target_width target_height PF_A8R8G8B8
557        texture rt1 target_width target_height PF_A8R8G8B8
558
559        target rt0
560        {
561            // Render output from previous compositor (or original scene)
562            input previous
563        }
564
565        target rt1
566        {
567            // Blur horizontally
568            input none
569                        pass render_quad
570                        {
571                                material Ogre/Compositor/HDR/GaussianBloom
572                                input 0 rt0
573                                identifier 700
574                        }
575        }
576
577                target_output
578        {
579            // Start with clear output
580            input none
581            // Blur vertically
582            pass render_quad
583            {
584                // Renders a fullscreen quad with a material
585                                material Ogre/Compositor/HDR/GaussianBloom
586                input 0 rt1
587                                identifier 701
588            }
589        }
590    }
591}
592
Note: See TracBrowser for help on using the repository browser.