29 lines
1 KiB
GLSL
29 lines
1 KiB
GLSL
#version 450 core
|
|
|
|
//! type fragment
|
|
|
|
layout( location = 0 ) uniform sampler2D u_InputTexture;
|
|
layout( location = 1 ) uniform vec2 u_OutputSize;
|
|
layout( location = 2 ) uniform int u_SourceLOD;
|
|
layout( location = 3 ) uniform vec2 u_Direction;
|
|
layout( location = 4 ) uniform vec4 u_Weights;
|
|
|
|
layout( location = 0 ) out vec3 color;
|
|
|
|
void main( void )
|
|
{
|
|
vec2 tmp = gl_FragCoord.xy / u_OutputSize;
|
|
vec2 disp = u_Direction / u_OutputSize;
|
|
color = u_Weights.x * textureLod( u_InputTexture , tmp , u_SourceLOD ).xyz
|
|
+ u_Weights.y * (
|
|
textureLod( u_InputTexture , tmp + disp , u_SourceLOD ).xyz
|
|
+ textureLod( u_InputTexture , tmp - disp , u_SourceLOD ).xyz )
|
|
+ u_Weights.z * (
|
|
textureLod( u_InputTexture , tmp + disp * 2 , u_SourceLOD ).xyz
|
|
+ textureLod( u_InputTexture , tmp - disp * 2 , u_SourceLOD ).xyz )
|
|
+ u_Weights.w * (
|
|
textureLod( u_InputTexture , tmp + disp * 3 , u_SourceLOD ).xyz
|
|
+ textureLod( u_InputTexture , tmp - disp * 3 , u_SourceLOD ).xyz )
|
|
;
|
|
color /= u_Weights.x + 2 * ( u_Weights.y + u_Weights.z + u_Weights.w );
|
|
}
|