Stencil targeting specific color

Hey,

I did a bunch of googling and couldn’t find an answer. I already use stencils so I am somewhat familiar with them. For the life of me, I can’t figure out how to target a different color other than B/W for stenciling. I’d like to stencil on let’s say red (255,0,0,255) and ignore all other colors.

Extra you don’t need to read below if you don’t want to:
I am redesigning water in my game. I thought maybe anything with “water” could be set to a high color like red (255,0,0,255) which at the end of the rendering, the stencil could draw water onto anything hitting that color range.

Dunno, maybe a fx file would be better and more efficient…

Something that came up:

Another thing:
https://docs.microsoft.com/en-us/windows/win32/direct3d11/d3d10-graphics-programming-guide-depth-stencil#:~:text=Reading%20the%20Depth-Stencil%20Buffer%20as%20a%20Texture%20The,use%20both%20the%20D3D10_BIND_DEPTH_STENCIL%20and%20D3D10_BIND_SHADER_RESOURCE%20bind%20flags.

This was a fun accidental find: [Spanish]

Found via this video:

Search phrase:
https://www.bing.com/search?q=xna+stencil+water+effects&cvid=51c9c2acc5c94161bda6abe180674643&pglt=43&FORM=ANNTA1&PC=U531

Sadly this is a dead link:

Relating to FX searches:
https://www.bing.com/search?q=xna+fx+water+&qs=n&form=QBRE&sp=-1&pq=xna+fx+water+&sc=0-13&sk=&cvid=1FC12634BD83472D9775BFD652650CBD

Something interesting…:

Will add these links to my links thread… some interesting stuff there…

Hope these help somewhat…

Thank you. I’ll see what I can learn from those to see if it will fit what I am trying to do. Your search queries were definitely very different than mine. I was looking at it from the stencil functionality, not water in general.

1 Like

Do share your findings!

Good luck!