Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Semi-constructive solid geometry in the stencil buffer

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

  1. Murgilod

    Murgilod

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

    https://dl.dropboxusercontent.com/u...er/WebPlayerRainFall3/WebPlayerRainFall3.html

    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.