24 lines
675 B
GLSL
24 lines
675 B
GLSL
#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 = 3 ) uniform vec2 u_Parameters;
|
|
|
|
layout( location = 0 ) out vec3 color;
|
|
|
|
void main( void )
|
|
{
|
|
vec2 tmp = gl_FragCoord.xy / u_OutputSize;
|
|
float f = u_Parameters.x;
|
|
color = textureLod( u_MainInput , tmp , 0 ).rgb;
|
|
vec3 bloom = vec3( 0 );
|
|
for ( int i = 0 ; i < 6 ; i ++ ) {
|
|
bloom += f * textureLod( u_BlurInput , tmp , i ).rgb;
|
|
f = pow( f , u_Parameters.y + 1 );
|
|
}
|
|
color = color + bloom / 2.2;
|
|
|
|
color = color / ( color + 1. );
|
|
color = pow( color , vec3( 1.0 / 2.2 ) );
|
|
}
|