Last active
February 5, 2025 16:32
-
-
Save AsefHossainKhan/32b74ea85d42aeee8602dcf462c1ef38 to your computer and use it in GitHub Desktop.
Android "Shader Editor" Application GLSL Camera Shader code [Pixelated Dithering in Black & White]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifdef GL_FRAGMENT_PRECISION_HIGH | |
precision highp float; | |
#else | |
precision mediump float; | |
#endif | |
uniform vec2 resolution; | |
uniform vec2 cameraAddent; | |
uniform mat2 cameraOrientation; | |
uniform samplerExternalOES cameraBack; | |
void main(void) { | |
vec2 uv = gl_FragCoord.xy / resolution.xy; | |
vec2 st = cameraAddent + uv * cameraOrientation; | |
vec3 color = texture2D(cameraBack, st).rgb; | |
float br = (color.x + color.y + color.z) / 3.0; | |
float white; | |
if (br < 0.4) { | |
white = 0.0; | |
} else if (br < 0.65) { | |
if (mod(floor(gl_FragCoord.x / 6.0), 2.0) == 0.0 && mod(floor(gl_FragCoord.y / 6.0), 2.0) == 0.0) { | |
white = 0.5; | |
} | |
} else { | |
white = 1.0; | |
} | |
color = vec3( | |
white, | |
white, | |
white); | |
gl_FragColor = vec4(color, 1.0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment