Sample code using 4.8 procedural mesh to show tracking bounds

I’ve been working on showing the shape of the DK2 tracking volume when you are about to move out of it.
The player can then be made aware when they are about to loose tracking.

The attached asset file contains an actor with code to create a procedural mesh the same size as the cameras tracking volume.
Position the mesh at the tracking camera’s location.
Assign a material to the mesh that’s only visible when you get close. I’m using a masked material, e.g.

Here is the code:

Please post your improvements. I think this is something we could share ideas on to create a common solution.


I’ll have to check this out when I get a chance.

Hey Jumbli, the volume seems to be too big. Do you know what could be the cause? I’ve used a simple material to show what I mean:


Try running the console command: “hmddbg showcamera toggle” to see how it compares to the tracking boundary drawn by the Oculus plugin. It should look the same.

The tracking parameters returned by the driver have a near and far plane. These define how close to the camera and how far away can be tracked. The near plane starts 40cm away from the camera which is why the boundary starts with quite a large rectangle rather than a point. If it’s the near plane rectangle that looks too big, you could try overriding their recommended setting. Search for the “Set near plane” in the code I provided and set your own value.

Many thanks for sharing this!! I will this out as soon as I can!

I’ve included this functionality in my latest demo if you want to download it and see it in action.

A few points to note:
I’ve used a wide red mesh so that it doesn’t obscure the view very much, but is still easily noticeable. I found that using a smaller pattern caused my eyes to quickly focus on it and distract me from the scene. Focusing on the mesh was uncomfortable due to it being close to my eyes. A wide mesh seems to avoid this problem.
The tracking seems to be lost a little before crossing the mesh so I think I may try scaling the tracking volume down a little so you see it earlier.

Another idea I am testing is “zero tolerance tracking failure”, i.e. when the tracking is lost I hide all the close scenery that would not react to positional changes and cause nausea. This probably seems harsh, but I find loosing positional tracking instantly uncomfortable. CV1 will have 360 degree tracking and a larger volume anyway, so maybe it won’t be so much of an issue.

Any feedback would be welcome.