Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- out vec4 FragColor;
- in vec2 TexCoord;
- uniform sampler2D Texture;
- //uniform float new_w, new_h, palette;
- vec4 pixelate(sampler2D tex, vec2 uv)
- {
- vec2 coord = vec2( ceil(uv.x * 320) /320,
- ceil(uv.y * 200) / 200 );
- return texture2D(tex, coord);
- }
- vec4 reduce_palette(vec4 color, float max_colors_per_channel)
- {
- if(max_colors_per_channel < 0) {
- return color;
- }
- return ceil(color * max_colors_per_channel) / max_colors_per_channel;
- }
- void main()
- {
- vec4 color = pixelate(Texture, TexCoord);
- FragColor = reduce_palette(color, 20);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement