Developing lens transparency shaders for AR headsets
HoloLens 2 and Magic Leap 2 – additive displays. They don't draw black background: holograms overlay directly on what user sees through glass. This fundamentally changes shader logic. "Transparency" here – not alpha blending over virtual background, but literal transparency for real world passing through lenses.
Developing shaders for such displays without understanding physical nature – means graphics either indistinguishable in bright rooms or looks muddy on dark objects.
Physics of additive display and shader consequences
On additive display, pixel with color (0, 0, 0) – absolutely transparent. Black color literally emits no light. This means dark hologram parts don't mask real world – everything visible through them. Creating illusion of opaque object requires object bright enough relative to surrounding light.
First consequence: standard Unity shaders with Rendering Mode = Opaque look not opaque, but semi-transparent, because their "dark" parts – shadows, AO, darkened faces – let real world through. HoloLens shader must minimize dark areas. Ambient lighting must raise significantly above physically correct values – practice Environment Lighting Intensity Multiplier 1.5 to 2.5 depending on scene.
Second consequence: alpha on additive display works differently. Alpha = 0 gives complete transparency (neither real world nor hologram visible – pixel just doesn't glow). But intermediate alpha values fade hologram appearance/disappearance, not blend with background. No "background" except real world.
Shader for controlled glass transparency
Main task for AR headset games – create effect of transparent glass with controlled opacity. Like shield partially blocking view, or spacecraft window.
In ShaderGraph (URP) this builds like: base object color mixed with Fresnel Effect emphasizing edges (glass reflects more at angle). Pure transparency zone center – Alpha near zero, edges – Alpha higher via Smoothstep. On dark object behind glass effect noticeable, on bright – almost invisible, because additive display doesn't darken real world.
For "frosted glass" effect use Procedural Noise as mask – breaks transparency uniformity, creates organic look. But can't use dark noise values for "fogging": dark areas simply become transparent. Fogging on additive display done with light color on top, not dark.
Separate shader – object outline. Standard outline via Stencil or Normal Extrusion doesn't work well on additive displays because dark outline invisible. Need glowing outline: Emission on contour pixels with intensity 2–4, color – warm or saturated (blue, green work better than red due to additive display spectrum).
Working with MRTK and Mixed Reality Toolkit
For HoloLens development done via MRTK (Mixed Reality Toolkit). MRTK has ready MRTKStandardShader, optimized for additive displays – accounts platform limitations, works significantly better than standard URP Lit. But capabilities limited, for custom effects need custom shaders with same principles.
Magic Leap 2 uses different SDK – Magic Leap Unity SDK – but display physics same: additive, just brighter. Shaders written for HoloLens mostly port directly, but must review ambient intensity thresholds due to different display brightness.
Case: cockpit interface with transparent screens
In AR-cockpit simulator needed implement instrument panels visible over real pilot seat. Screens should look glass – with visibility through them of real equipment behind screen.
Problem: emissive interface elements (scales, numbers) bright and readable. But screen "substrate" – dark gray rectangle – practically invisible (additive display doesn't show dark colors). Interface hung "in air" without frame giving sense of physical screen.
Solution: replace dark substrate with weakly glowing (Emission 0.15, warm gray color). Added enough glow so screen boundary visible, but not bright enough to cover real world. Additionally – Fresnel on housing edges with intensity 0.3 for shape emphasis.
| Shader type | Complexity | Estimated timeline |
|---|---|---|
MRTKStandardShader customization |
Medium | 2–5 days |
| Transparent glass shader (ShaderGraph) | Medium | 3–7 days |
| Complex effect (frosting, dynamic fogging) | High | 1–3 weeks |
| Shader porting between platforms | Depends on set | 1–2 weeks |
Cost calculated after requirements analysis and target platform (HoloLens 2, Magic Leap 2, or custom AR-device).





