Godot Version
Godot 4.7.1
Question
In this video, he creates a PS1 vertex snapping/wobble shader, but does not explain how to use it. I’ve tried applying it to a ColorRect node and as a Camera3D Compositor effect and neither work and I’m all out of ideas.
// PS1 Vertex Wobble Shader by Martin Donald
// @tutorial: https://youtu.be/_HBICOaFepY
shader_type spatial;
const vec2 SCREEN_RES = vec2(320.0, 240.0);
void vertex() {
vec4 view_pos = MODELVIEW_MATRIX * vec4(VERTEX, 1.0);
vec4 clip_pos = PROJECTION_MATRIX * view_pos;
vec2 ndc = clip_pos.xy / clip_pos.w;
vec2 screen_pos = ((ndc * 0.5) + 0.5) * SCREEN_RES;
screen_pos = floor(screen_pos + 0.5);
vec2 snapped_ndc = ((screen_pos / SCREEN_RES) - 0.5) * 2.0;
clip_pos.xy = snapped_ndc * clip_pos.w;
POSITION = clip_pos;
}
The const vec2 SCREEN_RES part was added by me because that constant is not built in to the shader language and is also not explained at all in the video, so I figured that SCREEN_RES should be the game’s internal resolution (320×240).