毕业设计之小地图

         小地图的制作比较简单,在主角上再挂一个相机,垂直照射主角,投影设为orthographic,在项目里面创建一个 render texture,拖到相机上,此时相机的内容都在render texturr上面。想要要他显示出来需要UI->raw image让其显示,拖到上面让其显示。但是此时显示会是正方形,变成圆形有两种方式。

          第一种解决方案:创建一个image,放一张透明的圆,在其上面加一个mask,然后把存放render texture的作为其子物体,成圆了。

          第二种解决方案,创建一个遮罩shader,代码如下:

..Shader "Custom/Mask" {
	Properties {
		_MainTex ("Main Texture", 2D) = "white" {}
		_Mask ("Mask Texture", 2D) = "white" {}
	}
	SubShader {
	
		Tags { "Queue" = "Transparent" }
		Lighting On
		ZWrite Off
		Blend SrcAlpha OneMinusSrcAlpha

		Pass
		{
			SetTexture [_Mask] {combine texture}
			SetTexture [_MainTex] {combine texture , previous}
		}
	} 
}

  但是此时是把所有东西都显示了,如果想让其显示图标的话,例如一个NPC或者主角,在其下面建个Quad,让其朝上,再把自己想要替换的图标替换。然后通过更改两个摄像机渲染层级选择渲染对象,效果如下。


猜你喜欢

转载自blog.csdn.net/qq_35957011/article/details/79569592