-
-
Save mewlist/8e17958f9f11e877386dcb7cd7d9eaf3 to your computer and use it in GitHub Desktop.
Hologram Shader
This file contains 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/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