Aetheria/Assets/Shaders/Brushes/CubicPulseBrush.shader
Reinier Vens d12d7c5c45 Initial ARPG Port
ARPG scene assets from old project are now correctly visualizing sectors generated by ZoneGenerator and updated by GameContext
2020-11-27 22:47:33 +00:00

63 lines
1.1 KiB
Text

Shader "Brushes/Cubic Pulse Brush" {
Properties {
_Depth ("Depth", Float) = 0.5
}
Category {
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" }
Blend One One
ColorMask RGB
Cull Off Lighting Off ZWrite Off
SubShader {
Pass {
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma target 2.0
#include "UnityCG.cginc"
float _Depth;
struct appdata_t {
float4 vertex : POSITION;
fixed4 color : COLOR;
float2 texcoord : TEXCOORD0;
};
struct v2f {
float4 vertex : SV_POSITION;
fixed4 color : COLOR;
float2 texcoord : TEXCOORD0;
};
float4 _MainTex_ST;
v2f vert (appdata_t v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.color = v.color;
o.texcoord = v.texcoord;
return o;
}
float cubicPulse( float c, float w, float x )
{
x = abs(x - c);
if( x>w ) return 0.0f;
x /= w;
return 1.0f - x*x*(3.0f-2.0f*x);
}
fixed4 frag (v2f i) : SV_Target
{
return _Depth * cubicPulse(0,.5,length(i.texcoord-float2(.5,.5)));
}
ENDCG
}
}
}
}