Skip to content

Instantly share code, notes, and snippets.

Created October 22, 2015 12:39
Show Gist options
  • Save anonymous/ddfd79b32379f44e43b5 to your computer and use it in GitHub Desktop.
Save anonymous/ddfd79b32379f44e43b5 to your computer and use it in GitHub Desktop.
Shader "Leon/Special/Yamiko" {
Properties {
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_Emissive ("Emissive", 2D) = "black" {}
_EmissiveColor ("Emissive Color", Color) = (1.0,1.0,1.0,1.0)
_EmissiveMultiplier ("Emissive Multiplier", Range(0.0,10.0)) = 1.0
_RimColor ("Rim Color", Color) = (0.1,0.1,0.1,1.0)
_RimPower ("Rim Power", Range(0.0,10.0)) = 5.0
_Glossiness ("Smoothness", Range(0,1)) = 0.5
[LM_Specular] _SpecColor("Specular", Color) = (0.0,0.0,0.0)
_SliceGuide ("Slice Guide (RGB)", 2D) = "white" {}
_SliceAmount ("Slice Amount", Range(0.0, 1.0)) = 0.0
_SliceColor ("Slice Color", Color) = (0,0.0,0.0,1.0)
_Cutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
// Physically based Standard lighting model, and enable shadows on all light types
#pragma surface surf StandardSpecular addshadow
// Use shader model 3.0 target, to get nicer looking lighting
#pragma target 3.0
sampler2D _MainTex;
sampler2D _Emissive;
struct Input {
half2 uv_MainTex;
float3 viewDir;
half2 uv_SliceGuide;
fixed _SliceAmount;
};
half _Glossiness;
fixed4 _Color;
fixed4 _EmissiveColor;
fixed _Cutoff;
fixed4 _RimColor;
fixed _RimPower;
fixed _EmissiveMultiplier;
sampler2D _SliceGuide;
fixed _SliceAmount;
fixed4 _SliceColor;
void surf (Input IN, inout SurfaceOutputStandardSpecular o) {
// Dissolve Effect
fixed t = tex2D (_SliceGuide, IN.uv_SliceGuide).rgb - _SliceAmount;
clip(t);
// Albedo comes from a texture tinted by color
//fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
o.Albedo = half4(0,0,0,1);
// Emission
fixed4 emissive = tex2D (_Emissive, IN.uv_MainTex) * _EmissiveColor;
o.Emission = emissive * emissive.a;
o.Emission *= _EmissiveMultiplier;
// Rim
fixed rim = 1.0 - saturate(dot (Unity_SafeNormalize(IN.viewDir), o.Normal));
o.Emission += (_RimColor.rgb * pow (rim, _RimPower)) * (_RimPower < 10);
// Metallic and smoothness come from slider variables
o.Alpha = emissive.a;
o.Specular = _SpecColor;
o.Smoothness = _Glossiness;
if (o.Alpha < _Cutoff) discard;
}
ENDCG
}
FallBack "Transparent/Cutout/Diffuse"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment