68 lines
1.9 KiB
Plaintext
68 lines
1.9 KiB
Plaintext
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
|
|
|
|
// Gradational shader
|
|
Shader "UsayaLib/3D/Unlit/LerpTextureTransparent" {
|
|
Properties {
|
|
_MainTex("Main Texture", 2D) = "white" {}
|
|
_MainColor ("Main Color", Color) = (1,1,1,1)
|
|
_SubTex ("Sub Texture", 2D) = "white" {}
|
|
_SubColor ("Sub Color", Color) = (1,1,1,1)
|
|
_TexLerp ("Texture Lerp", Range (0.0, 1.0)) = 0
|
|
}
|
|
|
|
SubShader {
|
|
Tags {
|
|
"RenderType" = "Transparent"
|
|
"Queue" = "Transparent"
|
|
}
|
|
|
|
Blend SrcAlpha OneMinusSrcAlpha
|
|
|
|
Pass {
|
|
CGPROGRAM
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
|
|
struct VertexInput {
|
|
float4 color : COLOR;
|
|
float4 pos: POSITION;
|
|
float2 uv: TEXCOORD0;
|
|
};
|
|
|
|
struct VertexOutput {
|
|
fixed4 color : COLOR0;
|
|
float4 v: SV_POSITION;
|
|
float2 uv: TEXCOORD0;
|
|
};
|
|
|
|
fixed4 _MainColor;
|
|
fixed4 _SubColor;
|
|
float _TexLerp;
|
|
|
|
// Vertex shader
|
|
VertexOutput vert(VertexInput input) {
|
|
|
|
VertexOutput output;
|
|
output.v = UnityObjectToClipPos(input.pos);
|
|
output.uv = input.uv;
|
|
|
|
output.color = (_MainColor * (1.0 - _TexLerp) + _SubColor * _TexLerp) * input.color;
|
|
return output;
|
|
}
|
|
|
|
sampler2D _MainTex;
|
|
sampler2D _SubTex;
|
|
|
|
// Pixel shader
|
|
fixed4 frag(VertexOutput output) : SV_Target {
|
|
fixed4 col, tex, subTex;
|
|
tex = tex2D(_MainTex, output.uv);
|
|
subTex = tex2D(_SubTex, output.uv);
|
|
col.rgba = (tex.rgba * (1.0 - _TexLerp) + subTex.rgba * _TexLerp) * output.color;
|
|
return col;
|
|
}
|
|
|
|
ENDCG
|
|
}
|
|
}
|
|
} |