Palette Filter and Pixelate combined

This is just two shaders combined, resulting in the background in my pic.

 

Here are the projects separately

 

https://godotshaders.com/shader/palette-filter-for-3d-and-2d/

https://godotshaders.com/shader/pixelate/

 

 

 

Shader code
shader_type canvas_item;

uniform bool flip ;
uniform sampler2D gradient : hint_black; // It can be whatever palette you want
uniform int amount = 40;

void fragment(){ 
	vec2 grid_uv = round(UV * float(amount)) / float(amount);
	vec4 col = texture(TEXTURE,grid_uv);
	
	float lum = dot(col.rgb,vec3(0.2126,0.7152,0.0722)); // luminance
	
	col = texture(gradient,vec2(abs(float(flip) - lum),0));
	
	COLOR = col;
}
Tags
Color, gradient, old, palette, pixel, retro
The shader code and all code snippets in this post are under CC0 license and can be used freely without the author's permission. Images and videos, and assets depicted in those, do not fall under this license. For more info, see our License terms.

Related shaders

Palette Filter For 3D and 2D

Edge Detection (Sobel Filter and Gaussian Blur)

Pixelate

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments