57 lines
1.5 KiB
Plaintext
57 lines
1.5 KiB
Plaintext
Shader "Custom/OutlineOnly"
|
|
{
|
|
Properties
|
|
{
|
|
_ClipTexture ("Clip", 2D) = "white" {}
|
|
_OutlineCol ("Outline Color", Color) = (0,0,0,1)
|
|
_OutlineFactor ("Outline Factor", Range(0.0, 1.0)) = 1.05
|
|
_Progress("Thick Progress", Range(0,1)) = 0
|
|
_ProgressA("Alpha Progress", Range(0,1)) = 0
|
|
}
|
|
SubShader
|
|
{
|
|
Tags { "Queue" = "Transparent" "RenderType" = "Opaque" }
|
|
|
|
Pass
|
|
{
|
|
Cull Front
|
|
|
|
CGPROGRAM
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
#include "UnityCG.cginc"
|
|
fixed4 _OutlineCol;
|
|
float _OutlineFactor;
|
|
float _Progress;
|
|
float _ProgressA;
|
|
sampler2D _ClipTexture;
|
|
struct v2f
|
|
{
|
|
float4 pos : SV_POSITION;
|
|
float2 uv : TEXCOORD0;
|
|
};
|
|
|
|
v2f vert(appdata_full v)
|
|
{
|
|
v2f o;
|
|
|
|
fixed3 outlinePos = v.vertex.xyz * ((_OutlineFactor * _Progress) + 1.0);
|
|
o.pos = UnityObjectToClipPos(outlinePos);
|
|
o.uv = v.texcoord;
|
|
|
|
return o;
|
|
}
|
|
|
|
fixed4 frag(v2f i) : SV_Target
|
|
{
|
|
// 用模型UV采样clip贴图
|
|
clip(tex2D(_ClipTexture, i.uv).r - (_ProgressA*1.2));
|
|
return _OutlineCol;
|
|
}
|
|
|
|
ENDCG
|
|
}
|
|
|
|
}
|
|
}
|