Can I use buffers to create masks for complex 3D shader effects?

Godot Version



I have a 3D shader effect that I’d like to do in two passes. In the first pass I’d draw the back faces of my mesh to a depth buffer to get a hollowed out image of my shape. In the second pass, I’d draw front faces, but also test against the depth buffer I created in the first pass. I’d also want this second pass to actually be composited into the final viewport image. At the moment I can kind of do this by having the first pass just draw into the scene’s depth buffer with back faces, but that is causing issues with other objects that are drawn behind it. I want this backface depth buffer to only be used with the second pass of objects using my custom shader.

Is there a way to do this with Godot’s render pipline?

Not yet but it may be possible in Godot 4.3

You can test with the latest dev snapshot Dev snapshot: Godot 4.3 dev 6 and using the rendering effects API Implement hooks into renderer by BastiaanOlij · Pull Request #80214 · godotengine/godot · GitHub