Skip to content

Instantly share code, notes, and snippets.

@insom
Created April 18, 2024 00:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save insom/d221dcb299028d9fa3aeb5b7121991ad to your computer and use it in GitHub Desktop.
Save insom/d221dcb299028d9fa3aeb5b7121991ad to your computer and use it in GitHub Desktop.
A shader to make the world use 216 web-safe colours.
#version 330
in vec2 texcoord;
uniform sampler2D tex;
uniform float opacity;
vec4 default_post_processing(vec4 c);
vec4 window_shader() {
vec2 texsize = textureSize(tex, 0);
vec4 color = texture2D(tex, texcoord / texsize, 0);
color.r *= 6;
color.r = round(color.r);
color.r /= 6;
color.g *= 6;
color.g = round(color.g);
color.g /= 6;
color.b *= 6;
color.b = round(color.b);
color.b /= 6;
return default_post_processing(color);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment