Post-processing spatial shader not applying on 3D objects

[GODOT 4.3 dev 6]

I tried to make a post-processing shader in Godot using a MeshInstance3D, but for some reason, when attempting to apply it in a scene with object, said spatial shader will apply to only the background environment and not to the 3D objects aswell. Does anyone know why does this happen?

Code for the shader
shader_type spatial;
render_mode unshaded;

uniform sampler2D screen_texture : source_color, hint_screen_texture, filter_nearest;
uniform sampler2D depth_texture : source_color, hint_depth_texture, filter_nearest;
uniform sampler2D normal_texture : source_color, hint_normal_roughness_texture, filter_nearest;

void vertex() {
	POSITION = vec4(VERTEX, 1.0);

void fragment() {
	vec3 original = texture(screen_texture, SCREEN_UV).rgb;
	ALBEDO = original / 2.0;

1 Like

Fixed, seem to be a sort of problem recurring with Godot 4.3 dev #, to fix I just did that

  • Open project folder from filesystem viewer (Explorer for Windows, (most likely) Dolphin for Linux), and whatever OSX has
  • delete the .godot directory from the project
  • open the project from godot 4.2

That’s too bad you weren’t able to get it working in 4.3-dev6. I’ve also been struggling with the same problem in 4.3.

From my experiments, whether the quadmesh sees the objects seems highly dependent on the render priority set on all the materials, as well as whether the materials on the objects are in a “next pass”. Oddly, it doesn’t seem to matter whether the quadmesh’s shader is set to disable depth draw, even though that moves it to the transparent pipeline.

I’m able to get it working under very specific conditions, but it’s fragile, and knowing that render order is not guaranteed across computers makes it seem dicey. I’m not familiar enough with 3D rendering to know if this problem is already covered in a reported issue for 4.3. I’d be curious if you or anyone else has more thoughts on this.

Edit: Sorry, I missed in your code that you were using the older code to position your quadmesh. Your problem might be fixed by following the directions for 4.3-dev6 here: Introducing Reverse Z (AKA I'm sorry for breaking your shader) I am probably describing a different problem.