unity使三维物体不被其他物体遮挡

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/mansir123/article/details/84344213

核心:更改zwrite
shader代码如下:

Shader "Custom/ZOffShader" {
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
}
SubShader {
Tags { "RenderType"="Transparent"  "Queue" = "Geometry+1"}
LOD 200
Pass{
Color (1,0,0,1)
ZTest Always
ZWrite Off
SetTexture[_MainTex] {
//constantColor (0,0,1,1)
//combine constant * texture 
}
}
Pass{
Material{
Diffuse (1,1,1,1)
                Ambient (1,1,1,1)
            }
            
Lighting On
Color(1,0,0,1)
SetTexture [_MainTex]{Combine texture * primary DOUBLE}
}
} 
FallBack "Diffuse"
}

如图
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/mansir123/article/details/84344213