How to render only Parts of the Minimap?

I got an Labyrinthgame. Everytime the user comes to an dead end there is a little Object he can pick up to unlock a part of the minimap. In the beginning there is no minimap only when he picks up the first part. I tried using Blocks to block the view of the minimap camera and disabling them when the user picks up a map piece but I don´t want to have such an ugly black minimap where only a part is visible.

Using a screenshot from the Minimap and apply textures onto the blocks also won´t work because the color of the minimap should change when the user comes close to the end.

1 Answer

1

Okay, solved the problem by using Depth Masks on the blocks that prevent the sight.

For everyone who want to do something like that do that:

Assets → create Shader

Delete everything and enter following code:

Shader "DepthMask"
{
    SubShader
    {
        Tags {"Queue" = "Geometry-1" }
        Lighting Off
        Pass
        {
            ZWrite On
            ZTest LEqual
            ColorMask 0    
        }
    }
}

apply to a material and use that material on the blocks which should prevent sight.