Shadows affect quad mesh postprocessing shader

Godot Version

4.1.4.stable.official

Question

I am writing a post processing shader that needs access to the depth and normalmap. I have followed the tutorial here: Advanced post-processing — Godot Engine (stable) documentation in English
and also double checked with this tutorial:
https://www.youtube.com/watch?v=gqe0InyIk4U&t=949s

However my view quad that acts as our screen is affected by shadows and lights in the scene. This is not what i want, and also not what happens in the linked youtube tutorial. I can see the shadows of the scene mapped directly to the screen and also the two lights in the scene make the post processing brigther the closer they are. Also if my view quad is stuck in the ground, the bottom half is not shaded, since it just stays black.

Is this normal, and how can i avoid it? Have i missed something obvious? My shader currently is just:

shader_type spatial;

uniform sampler2D screen_texture: hint_screen_texture;




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



void fragment() {

	vec3 screen_albedo = texture(screen_texture, SCREEN_UV).rgb;
	vec3 albedo = screen_albedo;

	ALBEDO = albedo;
}

So i “solved” the problem by removing the light shader of the screen quad. If someone finds this later, add this to the shader:

void light() {
DIFFUSE_LIGHT = vec3(1.0);
}

This should REALLY be added to the official docs.

Wouldn’t render_mode unshaded; at the top of the shader do the trick instead? This also renders faster compared to setting DIFFUSE_LIGHT in the light() function (as the unshaded render mode skips a lot of internal scene shader computations).

1 Like

Yea, this is probably the better solution.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.