1//Dark Sylinc's Bloom
2compositor Bloom
3{
4    technique
5    {
6        // Temporary textures
7        texture rt_output target_width target_height PF_BYTE_RGB
8        texture rt0 target_width_scaled 0.25 target_height_scaled 0.25 PF_BYTE_RGB
9        texture rt1 target_width_scaled 0.25 target_height_scaled 0.25 PF_BYTE_RGB
10
11        target rt_output
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            // Horizontal blur pass
22            pass render_quad
23            {
24                // Renders a fullscreen quad with a material
25                material Ogre/Compositor/BrightPass2
26                input 0 rt_output
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/BlurV
39                input 0 rt0
40            }
41        }
42
43        target rt0
44        {
45            // Start with clear texture
46            input none
47            // Horizontal blur pass
48            pass render_quad
49            {
50                // Renders a fullscreen quad with a material
51                material Ogre/Compositor/BlurH
52                input 0 rt1
53            }
54        }
55
56        target_output
57        {
58            // Start with clear output
59            input none
60            // Draw a fullscreen quad
61            pass render_quad
62            {
63                // Renders a fullscreen quad with a material
64                material Ogre/Compositor/BloomBlend2
65                input 0 rt_output
66                input 1 rt0
67            }
68        }
69    }
70}
71
72compositor Glass
73{
74    technique
75    {
76        texture rt0 target_width target_height PF_BYTE_RGB
77
78        target rt0 { input previous }
79
80        target_output
81        {
82            // Start with clear output
83            input none
84
85            pass render_quad
86            {
87                material Ogre/Compositor/GlassPass
88                input 0 rt0
89            }
90        }
91    }
92}
93
94compositor "Old TV"
95{
96    technique
97    {
98        texture rt0 target_width target_height PF_BYTE_RGB
99
100        // render scene to a texture
101        target rt0 { input previous }
102
103        target_output
104        {
105            // Start with clear output
106            input none
107
108            pass render_quad
109            {
110                // convert the previous render target to a black and white image, add some noise, distort it,
111                // then render to scene aligned quad
112                material Ogre/Compositor/OldTV
113                input 0 rt0
114            }
115        }
116    }
117}
118
119//! [manual_sample]
120// Black and white effect
121compositor B&W
122{
123    technique
124    {
125        // Temporary textures
126        texture rt0 target_width target_height PF_BYTE_RGBA
127
128        target rt0
129        {
130            // Render output from previous compositor (or original scene)
131            input previous
132        }
133
134        target_output
135        {
136            // Start with clear output
137            input none
138            // Draw a fullscreen quad with the black and white image
139            pass render_quad
140            {
141                // Renders a fullscreen quad with a material
142                material Ogre/Compositor/BlackAndWhite
143                input 0 rt0
144            }
145        }
146    }
147}
148//! [manual_sample]
149
150//compositor DOF // based on Blur but final pass does depth of field
151//{
152//    technique
153//    {
154//        // Temporary textures
155//        texture rt0 target_width target_height PF_BYTE_RGBA
156//        texture rt1 target_width target_height PF_BYTE_RGBA
157//
158//        target rt1
159//        {
160//            // Render output from previous compositor (or original scene)
161//            input previous
162//        }
163//
164//        target rt0
165//        {
166//            // Start with clear texture
167//            input none
168//            // Vertical blur pass
169//            pass render_quad
170//            {
171//                // Renders a fullscreen quad with a material
172//                material Ogre/Compositor/DOF_Blur0
173//                input 0 rt1
174//            }
175//        }
176//
177//        target rt1
178//        {
179//            // Start with clear texture
180//            input none
181//            // Horizontal blur pass
182//            pass render_quad
183//            {
184//                // Renders a fullscreen quad with a material
185//                material Ogre/Compositor/DOF_Blur1
186//                input 0 rt0
187//            }
188//        }
189//
190//        target_output
191//        {
192//            // Start with clear output
193//            input none
194//            // Draw a fullscreen quad
195//            pass render_quad
196//            {
197//                // Renders a fullscreen quad with a material
198//                material Ogre/Compositor/DOF_Blend
199//                input 0 rt0
200//                input 1 rt1
201//            }
202//        }
203//    }
204//}
205
206// Embossed (fake bump) effect
207compositor Embossed
208{
209    technique
210    {
211        // Temporary textures
212        texture rt0 target_width target_height PF_BYTE_RGBA
213
214        target rt0
215        {
216            // Render output from previous compositor (or original scene)
217            input previous
218        }
219
220        target_output
221        {
222            // Start with clear output
223            input none
224            // Draw a fullscreen quad with the black and white image
225            pass render_quad
226            {
227                // Renders a fullscreen quad with a material
228                material Ogre/Compositor/Embossed
229                input 0 rt0
230            }
231        }
232    }
233}
234
235// SharpenEdges
236compositor "Sharpen Edges"
237{
238    technique
239    {
240        // Temporary textures
241        texture rt0 target_width target_height PF_BYTE_RGBA
242
243        target rt0
244        {
245            // Render output from previous compositor (or original scene)
246            input previous
247        }
248
249        target_output
250        {
251            // Start with clear output
252            input none
253            // Draw a fullscreen quad with the black and white image
254            pass render_quad
255            {
256                // Renders a fullscreen quad with a material
257                material Ogre/Compositor/SharpenEdges
258                input 0 rt0
259            }
260        }
261    }
262}
263
264// Invert
265compositor Invert
266{
267    technique
268    {
269        // Temporary textures
270        texture rt0 target_width target_height PF_BYTE_RGBA
271
272        target rt0
273        {
274            // Render output from previous compositor (or original scene)
275            input previous
276        }
277
278        target_output
279        {
280            // Start with clear output
281            input none
282            // Draw a fullscreen quad with the black and white image
283            pass render_quad
284            {
285                // Renders a fullscreen quad with a material
286                material Ogre/Compositor/Invert
287                input 0 rt0
288            }
289        }
290    }
291}
292
293// Posterize
294compositor Posterize
295{
296    technique
297    {
298        // Temporary textures
299        texture rt0 target_width target_height PF_BYTE_RGBA
300
301        target rt0
302        {
303            // Render output from previous compositor (or original scene)
304            input previous
305        }
306
307        target_output
308        {
309            // Start with clear output
310            input none
311            // Draw a fullscreen quad with the black and white image
312            pass render_quad
313            {
314                // Renders a fullscreen quad with a material
315                material Ogre/Compositor/Posterize
316                input 0 rt0
317            }
318        }
319    }
320}
321
322// Laplace
323compositor Laplace
324{
325    technique
326    {
327        // Temporary textures
328        texture rt0 target_width target_height PF_BYTE_RGBA
329
330        target rt0
331        {
332            // Render output from previous compositor (or original scene)
333            input previous
334        }
335
336        target_output
337        {
338            // Start with clear output
339            input none
340            // Draw a fullscreen quad with the black and white image
341            pass render_quad
342            {
343                // Renders a fullscreen quad with a material
344                material Ogre/Compositor/Laplace
345                input 0 rt0
346            }
347        }
348    }
349}
350
351// Tiling
352compositor Tiling
353{
354    technique
355    {
356        // Temporary textures
357        texture rt0 target_width target_height PF_BYTE_RGBA
358
359        target rt0
360        {
361            // Render output from previous compositor (or original scene)
362            input previous
363        }
364
365        target_output
366        {
367            // Start with clear output
368            input none
369            // Draw a fullscreen quad with the black and white image
370            pass render_quad
371            {
372                // Renders a fullscreen quad with a material
373                material Ogre/Compositor/Tiling
374                input 0 rt0
375            }
376        }
377    }
378}
379
380// Old Movie
381compositor "Old Movie"
382{
383    technique
384    {
385        // Temporary textures
386        texture rt0 target_width target_height PF_A8B8G8R8
387
388        target rt0
389        {
390            // Render output from previous compositor (or original scene)
391            input previous
392        }
393
394        target_output
395        {
396            // Start with clear output
397            input none
398            // Draw a fullscreen quad with the black and white image
399            pass render_quad
400            {
401                // Renders a fullscreen quad with a material
402                material Ogre/Compositor/OldMovie
403                input 0 rt0
404            }
405        }
406    }
407}
408
409// HDR
410compositor HDR
411{
412	// floating point only for now
413	technique
414	{
415		compositor_logic HDR
416
417        // Temporary textures
418		// Fullsize HDR render target, used as tone mapping source
419        texture rt_full target_width target_height PF_FLOAT16_RGB
420		// Targets used for luminance evaluation (3x3 downsample, point filtering)
421		texture rt_lum0 1 1 PF_FLOAT16_RGB
422		texture rt_lum1 4 4 PF_FLOAT16_RGB
423		texture rt_lum2 16 16 PF_FLOAT16_RGB
424		texture rt_lum3 64 64 PF_FLOAT16_RGB
425		texture rt_lum4 128 128 PF_FLOAT16_RGB
426		// Bright-pass filtered target (tone mapped)
427		texture rt_brightpass 128 128 PF_BYTE_RGB
428		// Bloom filter targets
429		texture rt_bloom0 128 128 PF_BYTE_RGB
430		texture rt_bloom1 128 128 PF_BYTE_RGB
431
432
433		target rt_full
434		{
435			// No input, render differently
436			input none
437
438			// Use float target HDR material scheme (unclamped shaders)
439			material_scheme HDR
440
441			pass clear
442			{
443			}
444
445			pass render_scene
446			{
447			}
448
449		}
450
451		// Downsample the original HDR scene to extract luminence value
452		target rt_lum4
453		{
454            input none
455            pass render_quad
456            {
457                // Downsample using a 2x2 filter and convert to greyscale
458                material Ogre/Compositor/HDR/Downsample2x2Luminence
459                input 0 rt_full
460                identifier 994
461            }
462		}
463		target rt_lum3
464		{
465            input none
466            pass render_quad
467            {
468				// Downsample using a 3x3 filter
469                material Ogre/Compositor/HDR/Downsample3x3
470                input 0 rt_lum4
471                identifier 993
472            }
473		}
474		target rt_lum2
475		{
476            input none
477            pass render_quad
478            {
479                // Downsample using a 3x3 filter
480                material Ogre/Compositor/HDR/Downsample3x3
481                input 0 rt_lum3
482                identifier 992
483            }
484		}
485		target rt_lum1
486		{
487            input none
488            pass render_quad
489            {
490                // Downsample using a 3x3 filter
491                material Ogre/Compositor/HDR/Downsample3x3
492                input 0 rt_lum2
493                identifier 991
494            }
495		}
496		target rt_lum0
497		{
498            input none
499            pass render_quad
500            {
501                // Downsample using a 3x3 filter
502                material Ogre/Compositor/HDR/Downsample3x3
503                input 0 rt_lum1
504                identifier 990
505            }
506		}
507
508
509		target rt_brightpass
510		{
511            input none
512            pass render_quad
513            {
514                // Downsample using a 3x3 filter, hi-pass and tone map
515                material Ogre/Compositor/HDR/Downsample3x3Brightpass
516                input 0 rt_full
517		        input 1 rt_lum0
518				identifier 800
519            }
520		}
521
522		target rt_bloom1
523		{
524			input none
525			pass render_quad
526			{
527				// Blur horizontally
528				material Ogre/Compositor/HDR/GaussianBloom
529				input 0 rt_brightpass
530				identifier 701
531			}
532		}
533		target rt_bloom0
534		{
535			input none
536			pass render_quad
537			{
538				// Blur horizontally
539				material Ogre/Compositor/HDR/GaussianBloom
540				input 0 rt_bloom1
541				identifier 700
542			}
543		}
544
545
546		// Final output combines tone mapping of the original scene, with an
547		// exposure setting passed in as a GPU parameter, and an additive bloom
548		// effect
549		target_output
550		{
551			input none
552			pass render_quad
553			{
554				material Ogre/Compositor/HDR/ToneMapping
555				input 0 rt_full
556				input 1 rt_bloom0
557				input 2 rt_lum0
558			}
559		}
560
561
562	}
563
564}
565
566
567// Gaussian blur effect
568compositor "Gaussian Blur"
569{
570    technique
571    {
572		compositor_logic GaussianBlur
573
574        // Temporary textures
575        texture rt0 target_width target_height PF_BYTE_RGBA
576        texture rt1 target_width target_height PF_BYTE_RGBA
577
578        target rt0
579        {
580            // Render output from previous compositor (or original scene)
581            input previous
582        }
583
584        target rt1
585        {
586            // Blur horizontally
587            input none
588			pass render_quad
589			{
590				material Ogre/Compositor/HDR/GaussianBloom
591				input 0 rt0
592				identifier 700
593			}
594        }
595
596		target_output
597        {
598            // Start with clear output
599            input none
600            // Blur vertically
601            pass render_quad
602            {
603                // Renders a fullscreen quad with a material
604				material Ogre/Compositor/HDR/GaussianBloom
605                input 0 rt1
606				identifier 701
607            }
608        }
609    }
610}
611
612// Testing MRT
613compositor TestMRT
614{
615	technique
616	{
617		// temporary texture (MRT!)
618		// 4 sub-surfaces, all 32-bit
619		texture mrt0 target_width target_height PF_BYTE_RGBA PF_BYTE_RGBA PF_BYTE_RGBA PF_BYTE_RGBA
620
621        target mrt0
622        {
623            // Render scene using MRT-compatible material scheme
624          input none
625			material_scheme MRT
626			pass clear
627			{
628
629			}
630			pass render_scene
631			{
632			}
633        }
634
635		target_output
636		{
637			input none
638            pass render_quad
639            {
640                // Renders a fullscreen quad
641				material Ogre/MRTtest/quad
642				// bind 4 MRT surfaces as texture inputs
643                input 0 mrt0 0
644                input 1 mrt0 1
645				input 2 mrt0 2
646                input 3 mrt0 3
647          }
648
649		}
650
651	}
652}
653
654//Radial blur effect
655compositor "Radial Blur"
656{
657    technique
658    {
659        // Temporary textures
660        texture rt0 target_width target_height PF_BYTE_RGBA
661
662        target rt0
663        {
664            // Render output from previous compositor (or original scene)
665            input previous
666        }
667
668		target_output
669        {
670            // Start with clear output
671            input none
672            // Blur vertically
673            pass render_quad
674            {
675                // Renders a fullscreen quad with a material
676				material Ogre/Compositor/Radial_Blur
677                input 0 rt0
678            }
679        }
680    }
681}
682
683// ASCII effect
684compositor ASCII
685{
686    technique
687    {
688        // Temporary textures
689        texture rt0 target_width target_height PF_BYTE_RGBA
690        target rt0
691        {
692            // Render output from previous compositor (or original scene)
693            input previous
694        }
695
696        target_output
697        {
698            // Start with clear output
699            input none
700            // Draw a fullscreen quad with the black and white image
701            pass render_quad
702            {
703                // Renders a fullscreen quad with a material
704                material Ogre/Compositor/ASCII
705                input 0 rt0
706            }
707        }
708    }
709}
710
711// Halftone effect
712compositor Halftone
713{
714    technique
715    {
716        // Temporary textures
717        texture rt0 target_width target_height PF_BYTE_RGBA
718
719        target rt0
720        {
721            // Render output from previous compositor (or original scene)
722            input previous
723        }
724
725        target_output
726        {
727            // Start with clear output
728            input none
729            // Draw a fullscreen quad with the black and white image
730            pass render_quad
731            {
732                // Renders a fullscreen quad with a material
733                material Ogre/Compositor/Halftone
734                input 0 rt0
735            }
736        }
737    }
738}
739
740//Night Vision effect
741compositor "Night Vision"
742{
743    technique
744    {
745        texture rt0 target_width target_height PF_BYTE_RGBA
746
747	target rt0
748	{
749	    input previous
750	}
751
752	target_output
753	{
754	    input none
755
756	    pass render_quad
757	    {
758	    	material Ogre/Compositor/NightVision
759	    	input 0 rt0
760	    }
761	}
762    }
763}
764
765//Dither effect
766compositor Dither
767{
768    technique
769    {
770        texture rt0 target_width target_height PF_BYTE_RGBA
771
772	target rt0
773	{
774	    input previous
775	}
776
777	target_output
778	{
779	    input none
780
781	    pass render_quad
782	    {
783	    	material Ogre/Compositor/Dither
784	    	input 0 rt0
785	    }
786	}
787    }
788}
789
790compositor Compute
791{
792    technique
793    {
794        target_output
795        {
796            // just do normal rendering
797            input previous
798            // execute compute shaders post-render
799            pass compute
800            {
801                material Compute/Compositor
802                // the texture size is 256x256x1 and we have 16x16x1 threads per group
803                // so we have to launch 16x16x1 groups
804                thread_groups 16 16 1
805            }
806        }
807    }
808}