原理很简单,设置一张黑白的遮罩图,根据遮罩图的某个非alpha通道的颜色从深到浅,逐渐设置透明和溶解的颜色。
直接贴代码:
Shader "MyShader/DissMask" {
Properties {
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_MaskTex("Mask Image",2D) = "white"{}
_MainColor("Main Color", Color) = (1,1,1,1)
_LightColor("Light Color", Color) = (1,1,1,1)
_DissFactor("Diss Factor ",Range(0,1)) = 0
_Cutoff("_Cutoff ",Range(0,1)) = 0
}
SubShader {
Tags { "RenderType"="Transparent" }
LOD 200
Cull off
//ZWrite Off
CGPROGRAM
// Physically based Standard lighting model, and enable shadows on al