Search Unity

Point Cloud to mesh

Discussion in 'Scripting' started by prismpeppe, May 14, 2015.

  1. prismpeppe

    prismpeppe

    Joined:
    Jan 15, 2015
    Posts:
    6
    Hi to all.

    I have a unity project with a terrain and other gameobjects and I'd like to load a point cloud (gotten from socket stream) into the scene and transform it in a mesh.
    The point cloud will be sent continuosly, so I'd like to create the mash in an incremental way.

    Any help?

    Thanks
     
  2. hpjohn

    hpjohn

    Joined:
    Aug 14, 2012
    Posts:
    2,190
    So like marching cubes?
     
  3. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,744
    When you fabricate a mesh procedurally in Unity, you will be putting it into the .mesh field of a MeshFilter on a given GameObject, which will then have a MeshRenderer to display it.

    There are performance limitations related to setting up the mesh (generating the verts, the triangles, and then the normals and possibly UVs associated with it), as well as limitations related to size (maximum of 65k verts I believe). There are other considerations such as the bounding box, which determines when the object is in/out of the view frustum, etc.

    If you have a streaming level coming in you will need some kind of logic to quantize it into blocks that can each be their separate mesh, such that you can throw out older ones and keep going.

    Google for some Unity procedural geometry tutorials; Unity makes it trivially easy to create procedural geometry, and that will enable you to develop a feel for what you're going to have to consider in your particular problem space.