Unity 设置裁剪shader 镂空效果
Unity 设置裁剪shader编写一个MaskShader 脚本如下:
Shader "MaskShader"
{
Properties
{
_MainTex ("Base (RGB)", 2D) = "black" {}
_Mask ("Culling Mask", 2D) = "black" {}
_Cutoff ("Alpha cutoff", Range (0,1)) = 0.1
}
SubShader
{
Tags {"Queue"="Transparent"}
Lighting Off
ZWrite Off
Blend SrcAlpha OneMinusSrcAlpha
AlphaTest GEqual
Pass
{
SetTexture {combine texture}
SetTexture {combine texture, previous}
}
}
}
新建一个material 绑定shader ,要有一张 裁剪为黑色的裁剪图 会裁剪黑色
然后随便拉一个cube 拖上设置好的material就会出现镂空部分了
很不错 楼主是超人 难得一见的好帖 很好哦 LZ真是人才 好帖就是要顶 顶顶多好 真心顶 难得一见的好帖
页:
[1]
2