[5313] | 1 | //compositor DOF // based on Blur but final pass does depth of field |
---|
| 2 | //{ |
---|
| 3 | // technique |
---|
| 4 | // { |
---|
| 5 | // // Temporary textures |
---|
| 6 | // texture rt0 target_width target_height PF_A8R8G8B8 |
---|
| 7 | // texture rt1 target_width target_height PF_A8R8G8B8 |
---|
| 8 | // |
---|
| 9 | // target rt1 |
---|
| 10 | // { |
---|
| 11 | // // Render output from previous compositor (or original scene) |
---|
| 12 | // input previous |
---|
| 13 | // } |
---|
| 14 | // |
---|
| 15 | // target rt0 |
---|
| 16 | // { |
---|
| 17 | // // Start with clear texture |
---|
| 18 | // input none |
---|
| 19 | // // Vertical blur pass |
---|
| 20 | // pass render_quad |
---|
| 21 | // { |
---|
| 22 | // // Renders a fullscreen quad with a material |
---|
| 23 | // material Ogre/Compositor/DOF_Blur0 |
---|
| 24 | // input 0 rt1 |
---|
| 25 | // } |
---|
| 26 | // } |
---|
| 27 | // |
---|
| 28 | // target rt1 |
---|
| 29 | // { |
---|
| 30 | // // Start with clear texture |
---|
| 31 | // input none |
---|
| 32 | // // Horizontal blur pass |
---|
| 33 | // pass render_quad |
---|
| 34 | // { |
---|
| 35 | // // Renders a fullscreen quad with a material |
---|
| 36 | // material Ogre/Compositor/DOF_Blur1 |
---|
| 37 | // input 0 rt0 |
---|
| 38 | // } |
---|
| 39 | // } |
---|
| 40 | // |
---|
| 41 | // target_output |
---|
| 42 | // { |
---|
| 43 | // // Start with clear output |
---|
| 44 | // input none |
---|
| 45 | // // Draw a fullscreen quad |
---|
| 46 | // pass render_quad |
---|
| 47 | // { |
---|
| 48 | // // Renders a fullscreen quad with a material |
---|
| 49 | // material Ogre/Compositor/DOF_Blend |
---|
| 50 | // input 0 rt0 |
---|
| 51 | // input 1 rt1 |
---|
| 52 | // } |
---|
| 53 | // } |
---|
| 54 | // } |
---|
| 55 | //} |
---|
| 56 | |
---|
| 57 | // HDR |
---|
| 58 | compositor HDR |
---|
| 59 | { |
---|
| 60 | // floating point only for now |
---|
| 61 | technique |
---|
| 62 | { |
---|
| 63 | // Temporary textures |
---|
| 64 | // Fullsize HDR render target, used as tone mapping source |
---|
| 65 | texture rt_full target_width target_height PF_FLOAT16_RGB |
---|
| 66 | // Targets used for luminance evaluation (3x3 downsample, point filtering) |
---|
| 67 | texture rt_lum0 1 1 PF_FLOAT16_RGB |
---|
| 68 | texture rt_lum1 4 4 PF_FLOAT16_RGB |
---|
| 69 | texture rt_lum2 16 16 PF_FLOAT16_RGB |
---|
| 70 | texture rt_lum3 64 64 PF_FLOAT16_RGB |
---|
| 71 | texture rt_lum4 128 128 PF_FLOAT16_RGB |
---|
| 72 | // Bright-pass filtered target (tone mapped) |
---|
| 73 | texture rt_brightpass 128 128 PF_R8G8B8 |
---|
| 74 | // Bloom filter targets |
---|
| 75 | texture rt_bloom0 128 128 PF_R8G8B8 |
---|
| 76 | texture rt_bloom1 128 128 PF_R8G8B8 |
---|
| 77 | |
---|
| 78 | |
---|
| 79 | target rt_full |
---|
| 80 | { |
---|
| 81 | // No input, render differently |
---|
| 82 | input none |
---|
| 83 | |
---|
| 84 | // Use float target HDR material scheme (unclamped shaders) |
---|
| 85 | material_scheme HDR |
---|
| 86 | |
---|
| 87 | pass clear |
---|
| 88 | { |
---|
| 89 | } |
---|
| 90 | |
---|
| 91 | pass render_scene |
---|
| 92 | { |
---|
| 93 | } |
---|
| 94 | |
---|
| 95 | } |
---|
| 96 | |
---|
| 97 | // Downsample the original HDR scene to extract luminence value |
---|
| 98 | target rt_lum4 |
---|
| 99 | { |
---|
| 100 | input none |
---|
| 101 | pass render_quad |
---|
| 102 | { |
---|
| 103 | // Downsample using a 2x2 filter and convert to greyscale |
---|
| 104 | material Ogre/Compositor/HDR/Downsample2x2Luminence |
---|
| 105 | input 0 rt_full |
---|
| 106 | identifier 994 |
---|
| 107 | } |
---|
| 108 | } |
---|
| 109 | target rt_lum3 |
---|
| 110 | { |
---|
| 111 | input none |
---|
| 112 | pass render_quad |
---|
| 113 | { |
---|
| 114 | // Downsample using a 3x3 filter |
---|
| 115 | material Ogre/Compositor/HDR/Downsample3x3 |
---|
| 116 | input 0 rt_lum4 |
---|
| 117 | identifier 993 |
---|
| 118 | } |
---|
| 119 | } |
---|
| 120 | target rt_lum2 |
---|
| 121 | { |
---|
| 122 | input none |
---|
| 123 | pass render_quad |
---|
| 124 | { |
---|
| 125 | // Downsample using a 3x3 filter |
---|
| 126 | material Ogre/Compositor/HDR/Downsample3x3 |
---|
| 127 | input 0 rt_lum3 |
---|
| 128 | identifier 992 |
---|
| 129 | } |
---|
| 130 | } |
---|
| 131 | target rt_lum1 |
---|
| 132 | { |
---|
| 133 | input none |
---|
| 134 | pass render_quad |
---|
| 135 | { |
---|
| 136 | // Downsample using a 3x3 filter |
---|
| 137 | material Ogre/Compositor/HDR/Downsample3x3 |
---|
| 138 | input 0 rt_lum2 |
---|
| 139 | identifier 991 |
---|
| 140 | } |
---|
| 141 | } |
---|
| 142 | target rt_lum0 |
---|
| 143 | { |
---|
| 144 | input none |
---|
| 145 | pass render_quad |
---|
| 146 | { |
---|
| 147 | // Downsample using a 3x3 filter |
---|
| 148 | material Ogre/Compositor/HDR/Downsample3x3 |
---|
| 149 | input 0 rt_lum1 |
---|
| 150 | identifier 990 |
---|
| 151 | } |
---|
| 152 | } |
---|
| 153 | |
---|
| 154 | |
---|
| 155 | target rt_brightpass |
---|
| 156 | { |
---|
| 157 | input none |
---|
| 158 | pass render_quad |
---|
| 159 | { |
---|
| 160 | // Downsample using a 3x3 filter, hi-pass and tone map |
---|
| 161 | material Ogre/Compositor/HDR/Downsample3x3Brightpass |
---|
| 162 | input 0 rt_full |
---|
| 163 | input 1 rt_lum0 |
---|
| 164 | identifier 800 |
---|
| 165 | } |
---|
| 166 | } |
---|
| 167 | |
---|
| 168 | target rt_bloom1 |
---|
| 169 | { |
---|
| 170 | input none |
---|
| 171 | pass render_quad |
---|
| 172 | { |
---|
| 173 | // Blur horizontally |
---|
| 174 | material Ogre/Compositor/HDR/GaussianBloom |
---|
| 175 | input 0 rt_brightpass |
---|
| 176 | identifier 701 |
---|
| 177 | } |
---|
| 178 | } |
---|
| 179 | target rt_bloom0 |
---|
| 180 | { |
---|
| 181 | input none |
---|
| 182 | pass render_quad |
---|
| 183 | { |
---|
| 184 | // Blur horizontally |
---|
| 185 | material Ogre/Compositor/HDR/GaussianBloom |
---|
| 186 | input 0 rt_bloom1 |
---|
| 187 | identifier 700 |
---|
| 188 | } |
---|
| 189 | } |
---|
| 190 | |
---|
| 191 | |
---|
| 192 | // Final output combines tone mapping of the original scene, with an |
---|
| 193 | // exposure setting passed in as a GPU parameter, and an additive bloom |
---|
| 194 | // effect |
---|
| 195 | target_output |
---|
| 196 | { |
---|
| 197 | input none |
---|
| 198 | pass render_quad |
---|
| 199 | { |
---|
| 200 | material Ogre/Compositor/HDR/ToneMapping |
---|
| 201 | input 0 rt_full |
---|
| 202 | input 1 rt_bloom0 |
---|
| 203 | input 2 rt_lum0 |
---|
| 204 | } |
---|
| 205 | } |
---|
| 206 | } |
---|
| 207 | } |
---|