Search Unity

Semi-constructive solid geometry in the stencil buffer

Discussion in 'Shaders' started by Murgilod, Aug 21, 2014.

  1. Murgilod


    Nov 12, 2013
    First up, here's a visual representation of what I'm trying to accomplish here.

    The blue bits what have lines in them after just a separate material rendering the backfaces with a screenspace effect. That's not really anything special, but it does demonstrate that I need the backfaces to be visible.

    Moving on:

    This article from 1999 implies that there's a way to do CSG-like operations in the stencil buffer, but it's talking a bit over my head. All I want to do is subtract a sphere from specifically tagged level geometry. How would I accomplish this? The article seems to imply it's possible, but hand-writing shaders isn't my forte.