Skip to content

Instantly share code, notes, and snippets.

@s2kw
Last active April 5, 2016 00:50
Show Gist options
  • Save s2kw/c5f70e89d1d02be1c10f6000b245cbd9 to your computer and use it in GitHub Desktop.
Save s2kw/c5f70e89d1d02be1c10f6000b245cbd9 to your computer and use it in GitHub Desktop.
/*-------------------------------------------------
System Designed,
Code Written,
by Kunihiro Sasakawa as [email protected]
-------------------------------------------------*/
Shader "SkyCircus/Frame/BokehShader" {
Properties {
_Color ("Color", Color) = (1,1,1)
_X ("X", Float ) = 0.5
_Y ("Y", Float ) = 0.5
}
SubShader {
Pass{
// Tags { "RenderType"="Opaque" }
Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
LOD 200
Blend SrcAlpha OneMinusSrcAlpha
CGPROGRAM
// Physically based Standard lighting model, and enable shadows on all light types
// #pragma surface surf Standard vert:vertex
#pragma vertex vert
#pragma fragment frag
// Use shader model 3.0 target, to get nicer looking lighting
#pragma target 3.0
#include "UnityCG.cginc"
float4 vert ( appdata_base v ) : POSITION
{
return mul(UNITY_MATRIX_MVP, v.vertex);
}
fixed _X;
fixed _Y;
fixed3 _Color;
fixed4 frag (float4 vertPos:WPOS) : COLOR
{
float3 p = _Color;
float x = vertPos.x / _ScreenParams.x - _X;
float y = vertPos.y / _ScreenParams.y - _Y;
float a = x * y + 1;
return float4(p * abs(a), 1 );
}
ENDCG
}
}
FallBack "Diffuse"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment