Rev | Line | |
---|
[390] | 1 | uniform sampler2D inRTT; |
---|
| 2 | uniform sampler2D inBloom; |
---|
| 3 | uniform sampler2D inLum; |
---|
| 4 | |
---|
| 5 | varying vec2 uv; |
---|
| 6 | |
---|
| 7 | // declare external function |
---|
| 8 | vec4 toneMap(in vec4 inColour, in float lum); |
---|
| 9 | |
---|
| 10 | void main(void) |
---|
| 11 | { |
---|
| 12 | // Get main scene colour |
---|
| 13 | vec4 sceneCol = texture2D(inRTT, uv); |
---|
| 14 | |
---|
| 15 | // Get luminence value |
---|
| 16 | vec4 lum = texture2D(inLum, vec2(0.5, 0.5)); |
---|
| 17 | |
---|
| 18 | // tone map this |
---|
| 19 | vec4 toneMappedSceneCol = toneMap(sceneCol, lum.r); |
---|
| 20 | |
---|
| 21 | // Get bloom colour |
---|
| 22 | vec4 bloom = texture2D(inBloom, uv); |
---|
| 23 | |
---|
| 24 | // Add scene & bloom |
---|
| 25 | gl_FragColor = vec4(toneMappedSceneCol.rgb + bloom.rgb, 1.0); |
---|
| 26 | |
---|
| 27 | } |
---|
| 28 | |
---|
Note: See
TracBrowser
for help on using the repository browser.