ディゾルブ - saitocastel1900/UnityShader GitHub Wiki
Shader "Unlit/DissolveUnlitShader"
{
Properties
{
_MainColor("Main Color",Color) = (1,1,1,1)
_DisolveColor("Color",Color) = (1,1,1,1)
_DisolveTex ("Disolve Texture", 2D) = "white"{}
_Threshold ("Threshold", Range(0, 1)) = 0.5
}
SubShader
{
Tags {
"RenderType"="Transparent"
"Queue"="Transparent"
"RenderPipeline"="UniversalPipeline"
}
Blend SrcAlpha OneMinusSrcAlpha
LOD 100
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
half4 _MainColor;
half4 _DisolveColor;
sampler2D _DisolveTex;
float _Threshold;
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};
struct v2f
{
float4 vertex : SV_POSITION;
float2 uv : TEXCOORD0;
};
v2f vert (appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = v.uv;
return o;
}
fixed4 frag (v2f i) : SV_Target
{
fixed4 dissovleColor = tex2D(_DisolveTex,i.uv);
fixed steps = step(dissovleColor,_Threshold);
return _DisolveColor * steps;
}
ENDCG
}
}
}