Loading video...
Video Failed to Load
I've previously shown how to use stencils using the Amplify Shader Editor. Today, I found out that the Poiyomi shader supports stencils. Here's how you can replicate this effect using that shader, it's gonna be a long thread. (1/6) #VRChat
32,674 views • 1 year ago •via X (Twitter)
6 Comments

Here's how I setup the window mesh. The mesh uses 3 materials : - The 1st material is applied to the frame, nothing special about it. - The 2nd material is used to render the city. - The 3rd material is used to render the avatar. I called the 2nd and 3rd materials "windows".

First of all, we don't need to render our windows, it's just a "portal". Under "Rendering", set "ZWrite = Off", "RGB Source Blend = Zero", "RGB Destination Blend = One". We also want to render our Window before the rest, so we set a lower render queue, here I set it to 1999.

The interesting part is in the stencil settings. - For our window materials, under "Rendering > Stencil", set "Stencil Pass Op = Replace" - For our scene and avatar materials, set "Stencil Compare Option = Equals"

Our first window should only render the scene, so ensure the "Stencil Reference Value" matches on both the window and scene materials. You can use any value except 0, I personally choose 1. This is because we set the "Stencil Compare Function" to "Equal", so the values must match

We need to do the same thing on our second window, but we will use a different "Stencil Reference Value", personally I choose 2. If you use outlines, make sure to apply the same settings under "Outline Stencil" Better explanations how it works

You can do some pretty neat tricks with stencils! And it's not only a tool for making these elaborate skits, I've seen people use it for small stylistic things like rendering eyes in front of hair
