Last active
March 13, 2017 02:50
-
-
Save JScott/7a8c034c5eec80df83c3a6b0c09251d9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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