demotool/bloom-combine.glsl

21 lines
526 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;
float f = .8;
color = textureLod( u_MainInput , tmp , 0 ).rgb;
for ( int i = 0 ; i < 5 ; i ++ ) {
color += f * textureLod( u_BlurInput , tmp , i ).rgb;
f *= .90;
}
color = color / ( color + 1. );
color = pow( color , vec3( 2.2 ) );
}