Stencil Buffers pt2 - object that only appears behind certain "glass"
More or less the same as what happened in the last post about stencil buffers - the few lines with Enums are useful - they "enumerate" - put all the functions into a drop down list in the Inspector for us. So we store these in variables - _SComp and _SOp. Notice the values are just numbers, as they are just entries in a list/array. A trick in the tutorial i watched was having an object only appear behind a certain "pane of glass" - or quad. The quad holds the stencil window shader and faces the object (so it faces away from the camera), and the SComp is set to always, the SOp is set to Replace. The trick is that both the object and glass have the same ref numbers, so if you had another pane of glass with a different ref number, the object does not appear behind it. The object's shader beneath, has a bump and albedo in it. Set the SComp to Equal (different to the last example we did) and the SOp to Keep. Shader "Dave/stencilwindow" { Properties{ ...