Hologram Shader
2 min readNov 4, 2019
Using Unity Shader Lab (HLSL(CG))
Implementing Rim Lighting Effect then Setting the Alpha to fade.
Fewer depth details Might be Produced by turning by Including a pass and getting the Z-Buffer calculation
Hologram CG program
CGPROGRAM
#pragma surface surf Lambert alpha:fade
#pragma target 3.0
float4 _RimColor;
half _RimRange;
struct Input
{
float3 viewDir;
};
void surf (Input IN, inout SurfaceOutput o)
{
half rim=1- saturate(dot(normalize(IN.viewDir),o.Normal));
o.Emission=_RimColor.rgb*pow(rim,_RimRange)*10;
o.Alpha=pow(rim,_RimRange);
}
ENDCG
For Turning Depth Details off use a pass before your CG Program
Pass{
ZWrite on
ColorMask 0
}
For Unity App Performance Optimization :