Start a new topic

3D Model Masking

3D Model Masking

Hello. I am impressed so far with Wikitude's 3D model handeling.. One thing I can not seem to figure out, is how to use a 3D object as a mask, or matte., to block out other 3D elements behind it.


For example, if I made a tunnel, and wanted it to appear over a marker on a wall. I want it to look like the tunnel goes INTO the wall. To make that illusion convincing I have to make sure they can't tilt the phone to far and see what is behind the scenes (can't see the exterior portion of the tunnel that is supposed to be hidden inside the wall).

Or if you wanted to create the effect of a monster, crawling out of a hole on the desk, you would not want the user to be able to see the monster before it climbed out of the hole.. you would want to use a mask, to hide anythig outside of the hole..


Any way to do that in Wikitude.. ideally by tagging a specific piece of geometry and telling it to behave as a mask/matte.



For example, see how these animations use masking to hide the 3D models, to give the illusion they go into the walls..






Hi Chris, 

cool idea. This should either be possible with the WikitudeSDK out of the box - though I didn't try that yet - or with some minor modifications. 
In the following I refer to the example where a box shape hole appears in the wall.

To realize this illusion you basically need two boxes. One which hides the target image and the objects within the box when looking at the hole from the side, and an open box at the same position, having a missing face aligned to the target image and representing the inside walls of the hole/tunnel.

The first box could be defined with a material showing alpha = 0, and with faces pointing to the outside of the box. That way the box is rendered to the depth buffer only, hiding objects behind it while still being invisible. The inner box can be rendered as usual, using color or a texture, with the faces pointing to the insde of the box. The user can then look throught the open face into the box.

If the box example works, you can create curved holes, tunnels or caves in the same manner, using two instances of the same 3d model representing the hiding shape and the visible inside by having normals to the outside an inside, respectively respectively and the materials as discussed above. For avoiding z-buffer fighting you could shrink the inner model by a small factor.

Let us know whether it worked out. If you have troubles send us the 3d model (fbx) so we can have a look at it.



Thanks for this idea Roland. That sounds like what I am looking for.. I think I understand the concept and how to make the geometry,normals, etc, but I am confused about how to define the material of the outside  

"The first box could be defined with a material showing alpha = 0" "That way the box is rendered to the depth buffer only, hiding objects behind it while still being invisible"

I can easily map a transparent texture to the outside box. But it's been my experinece so far that you can still see another part of the model through the transparent part of a texture (example: window glass) Atleast in the Wikitude 3D Encoder app you can. So I am hoping that there is a way to define it in code to do what you "rendered to the depth buffer only, hiding objects behind it while still being invisible"


Here is a zip file with a cube model that follows your outline Roland. Inner cube normals face inward.Outer cube normals face outward. Outcube is larger than inner cube to avoid z fighting. Also, objects remain separate and each has it's own texture. (outer cube has fully transparent texture).. 

Also attached a screen shot of what I see in Maya and in the Wikitude 3D encoder viewport.


Thanks for any help!

Yes, I see. I guess this won't work out of the box, but requires some changes in the 3d model export chain. The task is on my list. I'll try to include it into the next dev channel release.

Thx for the files. That helps. 

There's also another approach: In WikitudeSDK 5.0 there is a Unity plug-in included. So you can realize your rendering by setting up a unity project and use the Wikitude Unity plug-in to use the rendered objet as an augmentation upon a target. (See the Documetation on the Unity plug-in.)

Thanks Roland for the help. Would be a great feature. Either through a 3D work flow, or by tagging the object as a matteObject in the code, or a way to tag it within the wikitude 3D encoder, so that you can see the result there in the view port, and it gets baked into the wt3 export..  

And thanks for the unity tip. Might refer our dev guy to it and see if it helps for now.. 

Whats the current status on this topic? Has it been included in the SDK? I'm doing an location based AR app that needs this feature so using Unity is unfortunatley not an option for me.

Unfortunately it is not included SDK 5.3.

Ok. Thanks for your quick answer! Do you know any other solution so I can achieve my desired result? Can I for example replace the Wikitude rendering engine with for example babylon.js or three.js? Thanks 

Using the Wikitude Native SDK you can set up your own rendering. However, the interface is within the native OS environment (Java/C++ for Android and Objective C/C++ for iOS). 

Yeah I'm aware of that but as I understand the geolocation part of the SDK isn't available in the native SDKs? Thank you
Login or Signup to post a comment