79 lines
2.3 KiB
Plaintext

Shader "Unlit/BurObject"
{
Properties
{
//_MainTex ("Texture", 2D) = "white" {}
_Distance("Distance",Range(0,1))=1
//_Smooth("Smooth",Range(3,15))=6
}
SubShader
{
Tags { "RenderType"="Transparent" "Queue"="Transparent" }
LOD 100
Pass
{
Blend SrcAlpha OneMinusSrcAlpha
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
#include "Lighting.cginc"
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
float3 normal:NORMAL;
};
struct v2f
{
float2 uv : TEXCOORD0;
float4 vertex : SV_POSITION;
float3 normal : TEXCOORD1;
float3 wpos : TEXCOORD2;
};
sampler2D _BurTexture;
//sampler2D _MainTex;
//float4 _MainTex_ST;
float _Distance;
//float _Smooth;
v2f vert (appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = v.uv;//TRANSFORM_TEX(v.uv, _MainTex);
o.normal=UnityObjectToWorldNormal(v.normal);
o.wpos=mul(UNITY_MATRIX_M,v.vertex);
return o;
}
fixed4 frag (v2f i) : SV_Target
{
float2 uv=i.vertex.xy/_ScreenParams.xy;
// sample the texture
fixed4 col = tex2D(_BurTexture, uv);
float d=(length(i.uv-float2(0.5,0.5))+0.5-_Distance)*20;
d=1-saturate(1-d);
//float3 N=normalize(i.normal);
//float3 L=normalize(_WorldSpaceLightPos0.xyz);
//float3 V=normalize(_WorldSpaceCameraPos.xyz-i.wpos.xyz);
//float ndl=max(dot(N,L),0.00001);
//float ndh=max(pow(dot(N,normalize(L+V)),8),0.00001);
//float3 diff=ndl*_LightColor0*0.01;
//float3 sp=ndh*ndl*unity_LightColor0*0.01;
col.rgb= col.rgb+0.005;//+diff+sp;
//_Value*=d;
return float4(col.rgb,d);
}
ENDCG
}
}
}