I Learn About Stencil Buffers and Cutting Holes in Things @WorldOfZeroDevelopment
I Learn About Stencil Buffers and Cutting Holes in Things  @WorldOfZeroDevelopment
Uploaded April 2018 | Updated November 2026, 3 minutes ago
How do you cut holes in solid geometry? You don't... but you can fake it. To do that we're going to use the Stencil Buffer.

The Stencil Buffer is an 8 bit field that you can use in shaders to "Mark" pixels. This can be layered by using two shaders. The first can mark pixels on the stencil buffer and the second can use the stencil we created as a mask to draw. With some clever tricks we can use this to fake holes in the ground as well as some other fun stuff.

In this we'll explore how to use the Stencil Buffer and try to work around some issues when the stencil overlaps.

You can learn more about the Stencil Buffer and see some Unity examples here: docs.unity3d.com/Manual/SL-Stencil.html

You can see some other applications of Stencil Buffers here (used to create a mirror/portal): iloveshaders.blogspot.com/2011/05/using-stencil-buffer-rendering-stencil.html

Join the World of Zero Discord server: discord.gg/hU5Kq2u
I Learn About Stencil Buffers and Cutting Holes in ThingsBuilding an Editor Window - Unity Observer - Part 0Building a Cloud Game w/ @MicrosoftReactor - Day 2Prototyping the Sand Table - Sand Table - Part 1Pseudo-Random Colors with Hashed StringsLets Draw A Circle - Circle Pixel Shader - Part 2I Built A New WebsiteFinding Components on GameObjects - Unity Observer - Part 4Building The Minefield Game Board - From Live StreamBuilding the Idea Wheel Prototype - OBS Overlay - From Live StreamExploring Reflection - Unity Observer - Part 3Handling 3rd Person Camera Physics with SphereCasts
World of Zero |

I Learn About Stencil Buffers and Cutting Holes in Things

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER