2022-10-16 16:26:50 +00:00
|
|
|
#version 460 core
|
|
|
|
out vec4 FragColor;
|
|
|
|
|
|
|
|
in vec2 TexCoords;
|
|
|
|
|
|
|
|
uniform sampler2D screenTexure;
|
2022-10-16 16:58:21 +00:00
|
|
|
const float offset = 1.0/ 300.0;
|
2022-10-16 16:26:50 +00:00
|
|
|
|
|
|
|
void main(){
|
|
|
|
FragColor = texture(screenTexure, TexCoords);
|
2022-10-16 16:58:21 +00:00
|
|
|
|
|
|
|
// Inversion filter
|
|
|
|
//FragColor = vec4( vec3 (1.0 - texture(screenTexure, TexCoords) ), 1.0) ;
|
|
|
|
|
2023-05-19 18:48:24 +00:00
|
|
|
// Simple Grayscale
|
|
|
|
//FragColor = texture(screenTexure, TexCoords);
|
|
|
|
//float average = (FragColor.r + FragColor.g + FragColor.b) / 3.0;
|
|
|
|
//FragColor = vec4(average, average, average, 1.0);
|
|
|
|
|
2022-10-16 16:58:21 +00:00
|
|
|
// physically accurate grayscale
|
2023-05-19 18:48:24 +00:00
|
|
|
//FragColor = texture(screenTexure, TexCoords);
|
|
|
|
//float average = 0.2126 * FragColor.r + 0.7152 * FragColor.g + 0.0722 * FragColor.b;
|
|
|
|
//FragColor = vec4(average,average,average, 1.0);*/
|
2022-10-16 16:58:21 +00:00
|
|
|
|
|
|
|
vec2 offset[9] = vec2[] (
|
2023-05-19 18:48:24 +00:00
|
|
|
vec2(-offset, offset), // top-left
|
|
|
|
vec2(0.0f, offset), // top-center
|
|
|
|
vec2(offset, offset), // top-right
|
|
|
|
vec2(-offset, 0.0f), // center-left
|
|
|
|
vec2(0.0f, 0.0f), // center-center
|
|
|
|
vec2(offset, 0.0f), // center-right
|
|
|
|
vec2(-offset, -offset), // bottom-left
|
|
|
|
vec2(0.0f, -offset), // bottom-center
|
|
|
|
vec2(offset, -offset) // bottom-right
|
2022-10-16 16:58:21 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
// sharpen
|
2023-05-19 18:48:24 +00:00
|
|
|
float sharpen_kernel[9] = float[](
|
2022-10-16 16:58:21 +00:00
|
|
|
-1, -1, -1,
|
|
|
|
-1, 9, -1,
|
|
|
|
-1, -1, -1
|
2023-05-19 18:48:24 +00:00
|
|
|
);
|
2022-10-16 16:58:21 +00:00
|
|
|
|
|
|
|
// blur
|
2023-05-19 18:48:24 +00:00
|
|
|
float blur_kernel[9] = float[](
|
2022-10-16 16:58:21 +00:00
|
|
|
1.0 /16, 2.0 /16, 1.0 /16,
|
|
|
|
2.0 /16, 4.0 /16, 2.0 /16,
|
|
|
|
1.0 /16, 2.0 /16, 1.0 /16
|
2023-05-19 18:48:24 +00:00
|
|
|
);
|
2022-10-16 16:58:21 +00:00
|
|
|
|
|
|
|
// Edge-detection
|
2023-05-19 18:48:24 +00:00
|
|
|
float edgeDetection_kernel[9] = float[] (
|
2022-10-16 16:58:21 +00:00
|
|
|
1, 1, 1,
|
|
|
|
1, -8, 1,
|
|
|
|
1, 1, 1
|
|
|
|
);
|
|
|
|
|
2023-05-19 18:48:24 +00:00
|
|
|
//vec3 sampleTex[9];
|
|
|
|
//for (int i= 0; i < 9; i++) {
|
|
|
|
// sampleTex[i] = vec3(texture(screenTexure, TexCoords.st + offset[i]));
|
|
|
|
//}
|
2022-10-16 16:58:21 +00:00
|
|
|
|
2023-05-19 18:48:24 +00:00
|
|
|
//vec3 col = vec3(0.0);
|
|
|
|
//for (int i = 0; i < 9; i++) {
|
|
|
|
// col += sampleTex[i] * kernel[i];
|
|
|
|
//}
|
2022-10-16 16:58:21 +00:00
|
|
|
|
2023-05-19 18:48:24 +00:00
|
|
|
//FragColor = vec4(col, 1.0);
|
|
|
|
|
2022-10-16 16:26:50 +00:00
|
|
|
}
|