Adventure Creator Wikia
Advertisement

This shader script allows you to have a front mesh be fully transparent, allowing it to appear as the background, while still occluding the meshes going behind it. This creates the effect that the behind elements are under/behind/hidden by actual elements drawn in a simple image background.

The script was found here: https://stackoverflow.com/questions/72477399/occluding-parts-of-an-object-behind-a-transparent-object

To use it, simply set up a background as a Raw Image, create a Custom Shader script in Unity with the below script, and create a material from it that will be added to the meshes you want transparent.

Shader "Custom/Mask"
{
    Properties
    {
    }
    SubShader
    {
        Tags { "RenderType" = "Opaque" "Queue" = "Geometry-1" }
        LOD 100

        Blend Zero One

        Pass
        {

        }
    }
}
Advertisement