[SOLVED] Another minimap shader question

Hi all, I’m kind of managed to make my minimap, but one thing is still bothering me.

I’m using a camera to rendertexture my map. I apply this shader to the texture (creating a new material):

Shader "MaskedTexture"
{
   Properties
   {
      _MainTex ("Base (RGB)", 2D) = "white" {}
      _Mask ("Culling Mask", 2D) = "white" {}
      _Cutoff ("Alpha cutoff", Range (0,1)) = 0.1
   }
   SubShader
   {
      Tags {"Queue"="Transparent"}
      Lighting Off
      ZWrite Off
      Blend SrcAlpha OneMinusSrcAlpha
      AlphaTest GEqual [_Cutoff]
      Pass
      {
         SetTexture [_Mask] {combine texture}
         SetTexture [_MainTex] {combine texture, previous}
      }
   }
}

Then I apply this material in a plane and a second camera rendertexture this plane to a second texture.

Then I use a GUITexture to show the minimap in the screen.
The problem is: My mask is a circle, so I expected to see just a circle as the minimap, but what I’m getting a 50% alpha black square with a round minimap inside…

If I don’t apply the texture in a GUITexture, but in a plane, the 50% alpha black square disapears…

Any clue?
Thanks in advance,

[EDIT] - Damn, I solved like 5 min after posting here… hehe I just changed the Clear Flags of the second camera to Solid Color :slight_smile:

Hey,

I want to make a minimap too with my total map in perspective, so I can see myself walking in that world.

U used a second camera to do that.
Can you give some examples of how to manage that?

Thanks in advance

Hey Deoxyz, as I said above I used 2 cameras.
Te first was filming all my map and randering in a texture (tex1).

I created a material with the shader above (and tex1) and used it in a plane. A second camera was filming this plane and rendering another texture (tex2).

This tex2 is them rendered in a GUITexture.

Some tricks are always necessary depending on your project. But make sure the second camera can only film the plane’s layer.

I don’t have any example project with this right now, but I’m sure you can make it yourself, its not that hard now :slight_smile:

good luck, if you have any pontual issues, let me know.

Ok, thanks.
I’ll do my best :slight_smile: