Trying to fake shading with semi-transparent flat meshes

Godot 4.6

Question

I have a low-end computer and I thought I might be able to simulate a 3D shaded area by having a flat semi-transparent black mesh, so that everything behind it looks darker, and then beyond that, the same type of mesh except white so that it reverses the effect and only objects in the shade zone are darkened. However, the white mesh doesn’t perfectly reverse the darkening but just greys out what is behind it. Is there a way to make this method work or is this why I’ve never heard of it being used to fake shading?

My guess is that it’s the alpha blending method, or maybe you need to combine the “shading” in another buffer instead of iteratively changing colors in the main buffer.

If I’m understanding it correctly, and by default it’s doing “a • new + (1-a) • old”, then a 50% black-50% white pass will leave colors slightly darker.

1 Like

It won’t work that way. Use a decal or a shader.

I believe I found the solution. Transparency is more or less arbitrary, I originally set it to Alpha for both albedos but disabled it. It is about the blend mode. I set both to pure white, but made the shadow mesh blend mode subtract and the correction mesh blend mode to add. This is pretty much my desired effect, and the shadow zone darkness can be increased by increasing both Intensity values.

Only problem now is that if the player were, say, passing through a hallway, then once the camera passes the shadow mesh, the darkening would be gone and they would just see a white wall. That’s for another topic though.