How can I increment the stencil buffer?
forum.godotengine.org·12w·
Discuss: r/godot

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...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help