[390] | 1 | // Downsample a 2x2 area & turn into luminence (unclamped) |
---|
| 2 | fragment_program Ogre/Compositor/HDR/downscale2x2LuminenceHLSL_fp hlsl |
---|
| 3 | { |
---|
| 4 | source hdr.hlsl |
---|
| 5 | entry_point downscale2x2Luminence |
---|
| 6 | target ps_2_0 |
---|
| 7 | } |
---|
| 8 | fragment_program Ogre/Compositor/HDR/downscale2x2LuminenceGLSL_fp glsl |
---|
| 9 | { |
---|
| 10 | source hdr_downscale2x2luminence.glsl |
---|
| 11 | default_params |
---|
| 12 | { |
---|
| 13 | param_named inRTT int 0 |
---|
| 14 | } |
---|
| 15 | } |
---|
| 16 | fragment_program Ogre/Compositor/HDR/downscale2x2Luminence_fp unified |
---|
| 17 | { |
---|
| 18 | delegate Ogre/Compositor/HDR/downscale2x2LuminenceGLSL_fp |
---|
| 19 | delegate Ogre/Compositor/HDR/downscale2x2LuminenceHLSL_fp |
---|
| 20 | default_params |
---|
| 21 | { |
---|
| 22 | param_named_auto texelSize inverse_texture_size 0 |
---|
| 23 | } |
---|
| 24 | } |
---|
| 25 | |
---|
| 26 | material Ogre/Compositor/HDR/Downsample2x2Luminence |
---|
| 27 | { |
---|
| 28 | technique |
---|
| 29 | { |
---|
| 30 | pass |
---|
| 31 | { |
---|
| 32 | cull_hardware none |
---|
| 33 | cull_software none |
---|
| 34 | depth_check off |
---|
| 35 | |
---|
| 36 | vertex_program_ref Ogre/Compositor/StdQuad_vp |
---|
| 37 | { |
---|
| 38 | } |
---|
| 39 | fragment_program_ref Ogre/Compositor/HDR/downscale2x2Luminence_fp |
---|
| 40 | { |
---|
| 41 | } |
---|
| 42 | |
---|
| 43 | texture_unit |
---|
| 44 | { |
---|
| 45 | tex_coord_set 0 |
---|
| 46 | tex_address_mode clamp |
---|
| 47 | filtering none |
---|
| 48 | } |
---|
| 49 | } |
---|
| 50 | } |
---|
| 51 | } |
---|
| 52 | |
---|
| 53 | // Downsample a 3x3 area |
---|
| 54 | fragment_program Ogre/Compositor/HDR/downscale3x3HLSL_fp hlsl |
---|
| 55 | { |
---|
| 56 | source hdr.hlsl |
---|
| 57 | entry_point downscale3x3 |
---|
| 58 | target ps_2_0 |
---|
| 59 | } |
---|
| 60 | fragment_program Ogre/Compositor/HDR/downscale3x3GLSL_fp glsl |
---|
| 61 | { |
---|
| 62 | source hdr_downscale3x3.glsl |
---|
| 63 | default_params |
---|
| 64 | { |
---|
| 65 | param_named inRTT int 0 |
---|
| 66 | } |
---|
| 67 | } |
---|
| 68 | fragment_program Ogre/Compositor/HDR/downscale3x3_fp unified |
---|
| 69 | { |
---|
| 70 | delegate Ogre/Compositor/HDR/downscale3x3GLSL_fp |
---|
| 71 | delegate Ogre/Compositor/HDR/downscale3x3HLSL_fp |
---|
| 72 | default_params |
---|
| 73 | { |
---|
| 74 | param_named_auto texelSize inverse_texture_size 0 |
---|
| 75 | } |
---|
| 76 | } |
---|
| 77 | |
---|
| 78 | |
---|
| 79 | material Ogre/Compositor/HDR/Downsample3x3 |
---|
| 80 | { |
---|
| 81 | technique |
---|
| 82 | { |
---|
| 83 | pass |
---|
| 84 | { |
---|
| 85 | cull_hardware none |
---|
| 86 | cull_software none |
---|
| 87 | depth_check off |
---|
| 88 | |
---|
| 89 | vertex_program_ref Ogre/Compositor/StdQuad_vp |
---|
| 90 | { |
---|
| 91 | } |
---|
| 92 | fragment_program_ref Ogre/Compositor/HDR/downscale3x3_fp |
---|
| 93 | { |
---|
| 94 | } |
---|
| 95 | |
---|
| 96 | texture_unit |
---|
| 97 | { |
---|
| 98 | tex_coord_set 0 |
---|
| 99 | tex_address_mode clamp |
---|
| 100 | filtering none |
---|
| 101 | } |
---|
| 102 | } |
---|
| 103 | } |
---|
| 104 | } |
---|
| 105 | |
---|
| 106 | // Downsample a 3x3 area and perform a brightness filter pass |
---|
| 107 | fragment_program Ogre/Compositor/HDR/downscale3x3brightpassHLSL_fp hlsl |
---|
| 108 | { |
---|
| 109 | source hdr.hlsl |
---|
| 110 | entry_point downscale3x3brightpass |
---|
| 111 | target ps_2_0 |
---|
| 112 | } |
---|
| 113 | fragment_program Ogre/Compositor/HDR/utils_fp glsl |
---|
| 114 | { |
---|
| 115 | source hdr_tonemap_util.glsl |
---|
| 116 | } |
---|
| 117 | fragment_program Ogre/Compositor/HDR/downscale3x3brightpassGLSL_fp glsl |
---|
| 118 | { |
---|
| 119 | source hdr_downscale3x3brightpass.glsl |
---|
| 120 | // re-use common functions |
---|
| 121 | attach Ogre/Compositor/HDR/utils_fp |
---|
| 122 | default_params |
---|
| 123 | { |
---|
| 124 | param_named inRTT int 0 |
---|
| 125 | param_named inLum int 1 |
---|
| 126 | } |
---|
| 127 | } |
---|
| 128 | fragment_program Ogre/Compositor/HDR/downscale3x3brightpass_fp unified |
---|
| 129 | { |
---|
| 130 | delegate Ogre/Compositor/HDR/downscale3x3brightpassGLSL_fp |
---|
| 131 | delegate Ogre/Compositor/HDR/downscale3x3brightpassHLSL_fp |
---|
| 132 | default_params |
---|
| 133 | { |
---|
| 134 | param_named_auto texelSize inverse_texture_size 0 |
---|
| 135 | } |
---|
| 136 | } |
---|
| 137 | |
---|
| 138 | |
---|
| 139 | material Ogre/Compositor/HDR/Downsample3x3Brightpass |
---|
| 140 | { |
---|
| 141 | technique |
---|
| 142 | { |
---|
| 143 | pass |
---|
| 144 | { |
---|
| 145 | cull_hardware none |
---|
| 146 | cull_software none |
---|
| 147 | depth_check off |
---|
| 148 | |
---|
| 149 | vertex_program_ref Ogre/Compositor/StdQuad_vp |
---|
| 150 | { |
---|
| 151 | } |
---|
| 152 | fragment_program_ref Ogre/Compositor/HDR/downscale3x3brightpass_fp |
---|
| 153 | { |
---|
| 154 | } |
---|
| 155 | |
---|
| 156 | // Scene |
---|
| 157 | texture_unit |
---|
| 158 | { |
---|
| 159 | tex_coord_set 0 |
---|
| 160 | tex_address_mode clamp |
---|
| 161 | filtering none |
---|
| 162 | } |
---|
| 163 | // Luminence |
---|
| 164 | texture_unit |
---|
| 165 | { |
---|
| 166 | tex_address_mode clamp |
---|
| 167 | filtering none |
---|
| 168 | } |
---|
| 169 | } |
---|
| 170 | } |
---|
| 171 | } |
---|
| 172 | |
---|
| 173 | // Bloom an area using gaussian distribution |
---|
| 174 | fragment_program Ogre/Compositor/HDR/bloomHLSL_fp hlsl |
---|
| 175 | { |
---|
| 176 | source hdr.hlsl |
---|
| 177 | entry_point bloom |
---|
| 178 | target ps_2_0 |
---|
| 179 | } |
---|
| 180 | fragment_program Ogre/Compositor/HDR/bloomGLSL_fp glsl |
---|
| 181 | { |
---|
| 182 | source hdr_bloom.glsl |
---|
| 183 | default_params |
---|
| 184 | { |
---|
| 185 | param_named inRTT int 0 |
---|
| 186 | } |
---|
| 187 | } |
---|
| 188 | fragment_program Ogre/Compositor/HDR/bloom_fp unified |
---|
| 189 | { |
---|
| 190 | delegate Ogre/Compositor/HDR/bloomGLSL_fp |
---|
| 191 | delegate Ogre/Compositor/HDR/bloomHLSL_fp |
---|
| 192 | } |
---|
| 193 | |
---|
| 194 | |
---|
| 195 | material Ogre/Compositor/HDR/GaussianBloom |
---|
| 196 | { |
---|
| 197 | technique |
---|
| 198 | { |
---|
| 199 | pass |
---|
| 200 | { |
---|
| 201 | cull_hardware none |
---|
| 202 | cull_software none |
---|
| 203 | depth_check off |
---|
| 204 | |
---|
| 205 | vertex_program_ref Ogre/Compositor/StdQuad_vp |
---|
| 206 | { |
---|
| 207 | } |
---|
| 208 | fragment_program_ref Ogre/Compositor/HDR/bloom_fp |
---|
| 209 | { |
---|
| 210 | } |
---|
| 211 | |
---|
| 212 | // Input |
---|
| 213 | texture_unit |
---|
| 214 | { |
---|
| 215 | tex_coord_set 0 |
---|
| 216 | tex_address_mode clamp |
---|
| 217 | filtering none |
---|
| 218 | } |
---|
| 219 | } |
---|
| 220 | } |
---|
| 221 | } |
---|
| 222 | |
---|
| 223 | |
---|
| 224 | // Perform final tone mapping |
---|
| 225 | fragment_program Ogre/Compositor/HDR/finaltonemappingHLSL_fp hlsl |
---|
| 226 | { |
---|
| 227 | source hdr.hlsl |
---|
| 228 | entry_point finalToneMapping |
---|
| 229 | target ps_2_0 |
---|
| 230 | } |
---|
| 231 | fragment_program Ogre/Compositor/HDR/finaltonemappingGLSL_fp glsl |
---|
| 232 | { |
---|
| 233 | source hdr_finalToneMapping.glsl |
---|
| 234 | // re-use common functions |
---|
| 235 | attach Ogre/Compositor/HDR/utils_fp |
---|
| 236 | default_params |
---|
| 237 | { |
---|
| 238 | param_named inRTT int 0 |
---|
| 239 | param_named inBloom int 1 |
---|
| 240 | param_named inLum int 2 |
---|
| 241 | } |
---|
| 242 | } |
---|
| 243 | fragment_program Ogre/Compositor/HDR/finaltonemapping_fp unified |
---|
| 244 | { |
---|
| 245 | delegate Ogre/Compositor/HDR/finaltonemappingHLSL_fp |
---|
| 246 | delegate Ogre/Compositor/HDR/finaltonemappingGLSL_fp |
---|
| 247 | } |
---|
| 248 | |
---|
| 249 | material Ogre/Compositor/HDR/ToneMapping |
---|
| 250 | { |
---|
| 251 | technique |
---|
| 252 | { |
---|
| 253 | pass |
---|
| 254 | { |
---|
| 255 | cull_hardware none |
---|
| 256 | cull_software none |
---|
| 257 | depth_check off |
---|
| 258 | |
---|
| 259 | vertex_program_ref Ogre/Compositor/StdQuad_vp |
---|
| 260 | { |
---|
| 261 | } |
---|
| 262 | fragment_program_ref Ogre/Compositor/HDR/finaltonemapping_fp |
---|
| 263 | { |
---|
| 264 | } |
---|
| 265 | |
---|
| 266 | // Scene |
---|
| 267 | texture_unit |
---|
| 268 | { |
---|
| 269 | tex_coord_set 0 |
---|
| 270 | tex_address_mode clamp |
---|
| 271 | } |
---|
| 272 | // Bloom |
---|
| 273 | texture_unit |
---|
| 274 | { |
---|
| 275 | tex_address_mode clamp |
---|
| 276 | } |
---|
| 277 | // Luminence |
---|
| 278 | texture_unit |
---|
| 279 | { |
---|
| 280 | tex_address_mode clamp |
---|
| 281 | } |
---|
| 282 | } |
---|
| 283 | } |
---|
| 284 | } |
---|
| 285 | |
---|
| 286 | |
---|