Hey would any Godot rendering geniuses be willing to help me figure out how to get this post-processing shader (link below) working as a Compositor Effect? It's a fairly simple dither effect that uses the depth buffer to apply gradual noise to the colors to give a really interesting jitter to the dithers that I really like. AFAIK this kind of shader is only possible with the janky "plane that always renders and is vertex mapped to the camera at all times" trick, or with Compositor Effects.

In my testing, I've been able to get basic compositor effects working, but this one keeps complaining that my push constant is of the wrong size, and the size changes seemingly randomly from the editor viewport and runtime. Not certain how to resolve that issue. Any help would be appreciated!

Update : I kinda got this working, at least to my standards. I gave up on getting the depth-based fog and noise and used the basic plane trick for that. But for posterization and dithering, those worked just fine for compositor effects. I might need to share this process somehow like as a blog post or something IDK IDK am tired rn


Link:
https://godotshaders.com/shader/psx-style-camera-shader/

Extra Tags for reach, please boost
#GameDev #GodotEngine #Godot #GLSL #Shaders
PSX Style Camera Shader – Distance Fog, Dithering, Color Limiter, Noise - Godot Shaders

Only works on Godot 4.3 and later! For a 4.2...

Godot Shaders

@Tom_ofB @queenofsquiggles

If you want some more inputs/examples check also: https://rokojori.com/en/labs/rokojori-action-library/tutorials/compositor-effects/overview

I also could not find a clear rule set where I felt I definetly get push constant alignment 😅. I usually just stick to float-types, start with the biggest first (mat4, vec4, vec2, float) and than (except mat4) use always 4. For example 4×vec4 4×vec2 4xfloat. That usually resolves it.
The alignment has some rules with specific byte sizes that are also more complicated when you use structs