How can I increment the stencil buffer?
forum.godotengine.org·7h·
Discuss: r/godot
Flag this post

November 9, 2025, 1:51pm 1

Hello! I’m new to rendering stuff and have programmed only basic shaders before, so please keep that in mind.

What I’m trying to achieve (In case stencil buffer is the completely wrong approach) Let’s say we have a Mesh A and it’s completely rendered in white. Now let’s say we have a Mesh B that is a bit closer. I want it to “see” what’s behind it and render in the opposite color. So, let’s say it completely overlaps with Mesh A. Thus, it renders completely black. And last but not least, I have Mesh C, which is the closest mesh. Mesh C overlaps a little bit with Mesh B as well as Mesh A. I want the parts that overlaps with A to be black, and the parts that overlap with B to be white.

What I tried so far

  1. Use `uniform sampler2D sc…

Similar Posts

Loading similar posts...