Skip to content

Instantly share code, notes, and snippets.

@mewlist
Created September 26, 2018 18:16
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 mewlist/8e17958f9f11e877386dcb7cd7d9eaf3 to your computer and use it in GitHub Desktop.
Save mewlist/8e17958f9f11e877386dcb7cd7d9eaf3 to your computer and use it in GitHub Desktop.
Hologram Shader
Shader "Custom/Holo" {
Properties {
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_Glossiness ("Smoothness", Range(0,1)) = 0.5
_Metallic ("Metallic", Range(0,1)) = 0.0
_Emission ("Emission", Range(0,1)) = 0.0
}
SubShader {
ColorMask 0
Tags {
"RenderType"="Transparent" }
LOD 200
Pass
{
ZWrite ON
ColorMask 0
}
Cull Off
Blend SrcAlpha OneMinusSrcAlpha
Zwrite On
ZTest LEqual
ColorMask RGBA
CGPROGRAM
#pragma surface surf Standard fullforwardshadows alpha:premul
#pragma target 3.0
sampler2D _MainTex;
struct Input {
float2 uv_MainTex;
float3 worldPos;
float3 worldNormal;
};
half _Glossiness;
half _Metallic;
half _Emission;
fixed4 _Color;
UNITY_INSTANCING_BUFFER_START(Props)
UNITY_INSTANCING_BUFFER_END(Props)
void surf (Input IN, inout SurfaceOutputStandard o) {
float3 lightDir = _WorldSpaceLightPos0;
fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
fixed3 d = normalize(IN.worldPos - _WorldSpaceCameraPos);
float p = 0.5 * dot(lightDir, IN.worldNormal) + 0.5;
float3 l = p * reflect(c.rgb, reflect(d, IN.worldNormal));
o.Albedo = clamp(fixed3(
0.7 * l.r + 0.1 * l.g + 0.2 * l.b,
0.2 * l.r + 0.7 * l.g + 0.1 * l.b,
0.1 * l.r + 0.2 * l.g + 0.7 * l.b
), 0 , 1);
o.Metallic = _Metallic;
o.Smoothness = _Glossiness;
o.Alpha = c.a;
o.Emission = _Emission * _LightColor0 * Luminance(o.Albedo);
}
ENDCG
}
FallBack "Diffuse"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment