demotool/bloom-combine.glsl

21 lines
525 B
Text
Raw Normal View History

#version 450 core
layout( location = 0 ) uniform sampler2D u_MainInput;
layout( location = 1 ) uniform sampler2D u_BlurInput;
layout( location = 2 ) uniform vec2 u_OutputSize;
layout( location = 0 ) out vec3 color;
void main( void )
{
vec2 tmp = gl_FragCoord.xy / u_OutputSize;
2017-09-30 18:30:26 +02:00
float f = .7;
color = textureLod( u_MainInput , tmp , 0 ).rgb;
for ( int i = 0 ; i < 5 ; i ++ ) {
color += f * textureLod( u_BlurInput , tmp , i ).rgb;
2017-09-30 18:30:26 +02:00
f *= .7;
}
color = color / ( color + 1. );
color = pow( color , vec3( 2.2 ) );
}