project tango 102 mesh builder+occlusion

here is what i have now:

so basically i add mesh builder and occlusion together. i tried to do it with the zombies like the last post, but sadly, the mesh created is not very good so the demo of zombie looks bad. but when i tested it, i suddenly found the effect of the ball is great! this video is play with a box, but i also tried to throw it to bed and sofa, also looks great.

now how to do this.

i tried to read the code of mesh builder but i was so sleepy.. so i just find something important and changed them. first is the size of the mesh, if you want to get a more detailed result, increase voxel resolution in MeshManager and MeshingCube. then i use the normal camera so i changed the main camera from multi camera to the normal one.(wait, maybe that’s the problem why it has gap between real world and mesh?)

then in GUIController, you dont need the depth cloud because you already have the meshes. when you want to create something, just create at the point where you hit the mesh.

then make the mesh be translucent. there are lots of ways to do that i’m sure. what i did is use the mask shader. so the mesh cube’s material is mask, and the game object has SetRenderQueue on them.  more details here http://wiki.unity3d.com/index.php?title=DepthMask  i treid to do the same way as occulusion in TangoPointCloud but it didnt work. not sure why.

the problem i have now are: 1. gap between real world and mesh. especially when you look at the table legs. that’s horrible. not sure if that’s the problem that i changed camera, will test this later. 2. the ground is rough, hard for zombies to move. will try to get the info of “this is the ground!”… no idea how to do that though.

quick steps:

1.open mesh builder scene, drag MeshManager, pointCloudScource, ballManager and SyntheticRoom out as prefab.

2.open Augment scene, drag those prefab in the scene, link the missing object in scripts.

3.disable guiController and TangoPointCloud

4.add setRenderQueue script on ball

using UnityEngine;

[AddComponentMenu(“Rendering/SetRenderQueue”)]

public class SetRenderQueue : MonoBehaviour {

[SerializeField]
protected int[] m_queues = new int[]{3000};

protected void Awake() {
Renderer[] renders = GetComponentsInChildren<Renderer>();
for (int i = 0; i < renders.Length; ++i) {
Material[] materials = renders[i].materials;
for(int k=0;k<materials.Length;k++){
materials[k].renderQueue = 3000;
}
}
}
}

5.change the shader of meshingcube to mask.

Shader “Masked/Mask” {

SubShader {
// Render the mask after regular geometry, but before masked geometry and
// transparent things.

Tags {“Queue” = “Geometry+10” }

// Don’t draw in the RGBA channels; just the depth buffer

ColorMask 0
ZWrite On

// Do nothing specific in the pass:

Pass {}
}
}

Advertisements
This entry was posted in ar, tango and tagged , . Bookmark the permalink.

4 Responses to project tango 102 mesh builder+occlusion

  1. sticklezz says:

    Is there any way you could export and share this? I can’t seem to get it to work following your directions, and I really would like to try this

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s