JJBB/Assets/Project/Shader/CameraBlur.shader

62 lines
1.2 KiB
Plaintext
Raw Normal View History

2024-08-23 15:49:34 +08:00
Shader "Zhanyou/Effect/CameraBlur"
{
Properties
{
[NoScaleOffset]_MainTex ("Texture", 2D) = "white" {}
[NoScaleOffset]_BumpTex ("Bump", 2D) = "bump" {}
//_Offset ("Offset", Range(0, 1)) = 0
//_Bright ("Bright", Range(0, 1)) = 1
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 100
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};
struct v2f
{
float2 uv : TEXCOORD0;
float4 vertex : SV_POSITION;
};
sampler2D _MainTex;
sampler2D _BumpTex;
float4 _MainTex_ST;
half _Offset;
half _Bright;
v2f vert (appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
return o;
}
fixed4 frag (v2f i) : SV_Target
{
fixed3 normal = UnpackNormal(tex2D(_BumpTex, i.uv));
fixed3 normal1 = UnpackNormal(tex2D(_BumpTex, i.uv.yx));
float2 uv = i.uv + normal.xy * _Offset;
uv = uv + normal1.xy * _Offset;
fixed4 col = tex2D(_MainTex, uv);
col.rgb = lerp(col.rgb, fixed3(1, 1, 1), _Bright);
return col;
}
ENDCG
}
}
}