Skip navigation
I've previously shown how to use stencils using the Amplify Shader Editor.
0:00 / 0:22

I've previously shown how to use stencils using the Amplify Shader Editor.

MyroP

@MyroDev1.9K followers

Visit on X
663 likesDownloadOriginal post

33,937 views #VRChat

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

6 Comments

Comments from the original post on X (Twitter)

  • MyroP's profile picture

    @MyroDev

    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".

    11 likes

  • MyroP's profile picture

    @MyroDev

    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.

    8 likes

  • MyroP's profile picture

    @MyroDev

    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"

    6 likes

  • MyroP's profile picture

    @MyroDev

    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

    7 likes

  • MyroP's profile picture

    @MyroDev

    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

    9 likes

  • Fancy's profile picture

    @Fancy_vr

    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

    34 likes