pixelated horror vignette dot-matrix downres
this is a post-processing shader that can be attached to a quad in front of the camera like explained here in the docs. This should also be easy to convert to a canvasitem shader if going that route. I’ll do it if someone asks…
I use this in compatibility, so should work anywhere.
The settings used in the screenshot:
- Brightness: 0.26
- Contrast: 3
- Scale: 1
- Rotation: 0.08
- Resolution Downsampling: 4
Shader code
shader_type spatial;
render_mode unshaded, fog_disabled;
uniform vec3 luminance: source_color = vec3(0.3086, 0.6094, 0.0820);
uniform float brightness: hint_range(0.01, 20.0, .01) = 0.26;
uniform float contrast: hint_range(1.0, 4.0, .01) = 3.0;
uniform float scale: hint_range(0.1, 10.0, .01) = 1.0;
uniform float rotation: hint_range(0.00, 6.28, .01) = 0.08;
uniform float resolution_downsampling: hint_range(1.0, 8.0, 1.0) = 4.0;
uniform sampler2D screen_texture: hint_screen_texture, filter_nearest, repeat_disable;
mat2 rotate(float a) {
float sa = sin(a);
float ca = cos(a);
return mat2(vec2(ca, sa), vec2(-sa, ca));
}
void vertex(){
POSITION = vec4(VERTEX.xy, 1.0, 1.0);
}
float dot_matrix(vec2 uv) {
vec2 rot_uv = rotate(rotation) * uv * scale;
return sin(rot_uv.x) * sin(rot_uv.y);
}
void fragment() {
vec2 UV_new = SCREEN_UV - mod(SCREEN_UV, 1.0/VIEWPORT_SIZE * resolution_downsampling);
vec2 resolution = VIEWPORT_SIZE;
vec3 color = texture(screen_texture, UV_new).rgb;
float grey = dot(color, luminance) * contrast;
color = vec3(grey + dot_matrix(UV * resolution));
float vignette = smoothstep(0.45, 0.1, distance(UV, vec2(0.5))) * 1.0;
float v_x = smoothstep(0.45, 0.1, distance(UV.x, 0.5));
float v_y = smoothstep(0.45, 0.1, distance(UV.y, 0.5));
ALBEDO = vec3(color * brightness) * vignette;
}
Could you make it a canvas item shader?
Yes, here you are:
dose it work with godot 4.3?