Skip to content

Instantly share code, notes, and snippets.

@JScott
Last active March 13, 2017 02:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JScott/7a8c034c5eec80df83c3a6b0c09251d9 to your computer and use it in GitHub Desktop.
Save JScott/7a8c034c5eec80df83c3a6b0c09251d9 to your computer and use it in GitHub Desktop.
Shader "Custom/BubbleGlow"
{
Properties {
_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
_RimColor("Rim Color", Color) = (1, 1, 1, 1)
_RimPower("Rim Power", Range(1.0, 6.0)) = 3.0
}
SubShader {
Tags {
"Queue"="Transparent+1"
"RenderType"="Transparent"
}
CGPROGRAM
#pragma surface surf Lambert alpha
sampler2D _MainTex;
float4 _RimColor;
float _RimPower;
struct Input {
float2 uv_MainTex;
float3 viewDir;
};
void surf (Input IN, inout SurfaceOutput o)
{
fixed4 c = tex2D(_MainTex, IN.uv_MainTex);
o.Albedo = c.rgb;
half rim = 1.0 - saturate(dot(normalize(IN.viewDir), o.Normal));
o.Alpha = pow(rim, _RimPower);
o.Emission = _RimColor.rgb * o.Alpha;
}
ENDCG
}
Fallback "Transparent/Cutout/VertexLit"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment