• Home  / 
  • Unity3D
  •  /  How to looking inside or through a wall on HoloLens

How to looking inside or through a wall on HoloLens

If you’re developing for the hololens, one of the coolest features you can have is see through walls.  Of course you can’t really see ‘through’ a wall, but you can place holograms in a way that they look like they’re inside or behind the wall.  For this to work though, you need to be able to mask out the wall in the foreground.

As an example, I’ll show a breakable wall we built at the last HoloHack, where you could see the cheese inside.

The wall is made up of 4 parts..

  1. Plaster
  2. Bricks
  3. Cheese (inside)
  4. The Occluder (makes it all work)

 

Plaster

Bricks behind the Plaster

Cheese behind the wall

 

It’s hard to see in screenshots, but the 3d depth really shows when you look on the hololens.

What’s with the big black cutout?

That’s the occluder.  It’s actually just a mesh, cut out int he shape we wanted the wall.  The material on it is using the Unlit Color shader set to black.

On HoloLens, solid black is rendered transparent.  With a mesh behind it, and the occluder on the wall, this actually makes the real world wall not visible, allowing you the ability to see ‘inside’ the wall.

I wish I could show a video of how this works, but recording on a hololens doesn’t show the occluder right (it looks correct in the headset but not the recording).

It’s also very important that you use an unlit shader (either unlit/color, or your own).  Any variance from a true black (0, 0, 0), will prevent this from working.

Important Note: A quad or UI sprite will NOT work.  The object needs a mesh of some sort.  It does work fine with a primitive cube though.

One of the best examples of this functionality I’ve seen is in Robo Raid.  You can see a quick video of it here.