Hologram Shader

Ahmed Schrute
Nov 4 · 2 min read
Car Hologram
Car Hologram

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

}

Ahmed Schrute

Written by

Visiting Grad Student @ Stanford & AR Enthusiastic

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade