init
This commit is contained in:
commit
f5c1616018
679 changed files with 188502 additions and 0 deletions
74
Assets/Shaders/Blur.shader
Normal file
74
Assets/Shaders/Blur.shader
Normal file
|
@ -0,0 +1,74 @@
|
|||
Shader "Geri/Blur"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_Radius("Radius", Range(0, 4)) = 1
|
||||
[HideInInspector] _MainTex ("Sprite Texture", 2D) = "white" {}
|
||||
}
|
||||
|
||||
Category
|
||||
{
|
||||
Tags
|
||||
{
|
||||
"Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "Opaque"
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
GrabPass
|
||||
{
|
||||
Tags
|
||||
{
|
||||
"LightMode" = "Always"
|
||||
}
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Tags
|
||||
{
|
||||
"LightMode" = "Always"
|
||||
}
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma fragmentoption ARB_precision_hint_fastest
|
||||
#include "Blur.cginc"
|
||||
|
||||
sampler2D _GrabTexture;
|
||||
float4 _GrabTexture_TexelSize;
|
||||
float _Radius;
|
||||
int _Enabled;
|
||||
|
||||
half4 first_pass(v2f i) {
|
||||
half4 sum = half4(0, 0, 0, 0);
|
||||
|
||||
sum += GRABXYPIXEL(0.0, 0.0);
|
||||
int measurments = 1;
|
||||
|
||||
for (float range = 1.f; range <= _Radius * 2; range += 1.f)
|
||||
{
|
||||
sum += GRABXYPIXEL(range, range);
|
||||
sum += GRABXYPIXEL(-range, range);
|
||||
sum += GRABXYPIXEL(range, 0);
|
||||
sum += GRABXYPIXEL(0, range);
|
||||
measurments += 4;
|
||||
}
|
||||
|
||||
half4 color = sum / measurments;
|
||||
i.color.a *= _Radius / 4.0;
|
||||
color = i.color * i.color.a + color * (1 - i.color.a);
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
half4 frag(v2f i) : COLOR
|
||||
{
|
||||
return first_pass(i);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue