Search Unity

[Released] Point Cloud Viewer Tools

Discussion in 'Assets and Asset Store' started by mgear, Apr 14, 2014.

  1. WbmCanada

    WbmCanada

    Joined:
    Oct 12, 2018
    Posts:
    4
    Thanks, I did start a conversation (if that's the correct way to do it).
     
  2. WbmCanada

    WbmCanada

    Joined:
    Oct 12, 2018
    Posts:
    4
    Hi,
    I have just imported the asset and getting this errors:

    Assets\PointCloudTools\PointCloudViewerDX11\Scripts\MeasurementManagerV2.cs(42,31): error CS0117: 'PointCloudManager' does not contain a definition for 'PointWasSelected'

    Assets\PointCloudTools\PointCloudViewerDX11\Scripts\MeasurementManagerV2.cs(43,31): error CS0117: 'PointCloudManager' does not contain a definition for 'PointWasSelected'


    Assets\PointCloudTools\Demos\PointCloudViewer\Scripts\PlaceMarkers.cs(23,31): error CS0117: 'PointCloudManager' does not contain a definition for 'PointWasSelected'

    Assets\PointCloudTools\Demos\PointCloudViewer\Scripts\PlaceMarkers.cs(54,35): error CS1061: 'PointCloudManager' does not contain a definition for 'RunPointPickingThread' and no accessible extension method 'RunPointPickingThread' accepting a first argument of type 'PointCloudManager' could be found (are you missing a using directive or an assembly reference?)

    Assets\PointCloudTools\Demos\PointCloudViewer\Scripts\PlaceMarkers.cs(61,31): error CS0117: 'PointCloudManager' does not contain a definition for 'PointWasSelected'

    Assets\PointCloudTools\PointCloudViewerDX11\Scripts\MeasurementManagerV2.cs(114,31): error CS0117: 'PointCloudManager' does not contain a definition for 'PointWasSelected'

    Thanks for the help!
     
  3. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,408
    Did you imported into existing project (with older version there)?
    If yes, try deleting the old folders first.
     
    WbmCanada likes this.
  4. Pycorax

    Pycorax

    Joined:
    May 30, 2016
    Posts:
    2
    Hi, I have a new project where we have to load and display a huge point cloud (20 million) on HoloLens. Of course, that is not very practical because the performance will most definitely be terrible. We have initially tried converting it to a model but it resulted in over a million polys which exactly viable.

    So I was wondering if it is possible to use this tool to render the point cloud directly in portions?
     
  5. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,408
    Unable to do any tests for hololens, but i'd probably try splitting the cloud into suitable areas (using external tools)
    then using the pointcloud2pointmesh converter to create mesh point clouds from those (and since they are regular gameobjects, you can hide/show them when needed..)

    the dx11 viewer has option to reduce point count dynamically, so that could be other option,
    using multiple dx11 viewers, with splitted cloud, then make your own script to adjust point count for each cloud based on distance.

    so, could have few options, but requires you to split the cloud before bringing it into this plugin.
     
    Pycorax likes this.
  6. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,408
    few answers first,
    certainly the current version wont be able to offer all those features out of the box.

    currently 100m points is around 60-70fps on a powerful desktop pc.
    (and slower if add vr to that, havent actually measured it recently that if single pass would be roughly similar values though)

    current version has dynamic point count adjust script, so that helps.
    (if 50m points would be 130fps, same cloud dynamically adjusted to 0 points is pretty much free, and its instant to adjust count). but it still loads the whole cloud into memory, so that one still needs work (to load on demand).

    point picking, its possible in the current version.
    so then its up to you to draw lines and save them to disk. (clicking gives you vector3 position to that point)

    runtime (las) files, parsing any kind of raw point cloud data is rather slow,
    so this could be certainly improved with native parser (and then pass xyzrgb values to my viewer).

    My plugin has custom binary format to make loading faster,
    but that requires the editor converter to convert point clouds into that format.
    (although there is caching option for runtime parser coming, it saves into optimized format for the next load, without having to convert in editor)

    splitting clouds should be done with external tools, cloudcompany has some, probably others too.
    and then assign each slice into separate viewer. (which could be also disabled at start, and enabled if close enough or so, to avoid loading everything in, if points are spread over large area)
     
  7. IsDon

    IsDon

    Joined:
    Feb 27, 2015
    Posts:
    35
    I've been planning to have a low-density cloud of the full project in an "always-on" state, then high density clouds in a grid of some sort which enable when close enough, or manually selected.

    I imagine something along those lines would give what the rick is after. Again, 1Bn points will require some testing...
     
    Rickmc3280 likes this.
  8. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,408
    couple more notes as info,
    currently HDRP, LWRP are not yet supported in DX11 viewer.
    (i have test version of LWRP helper that can be used though)

    real coordinates,
    in unity you cannot place objects too far from the 0,0,0, so my plugin has option to move clouds near 0,0,0
    (by taking first point position and subtracting that amount from coordinates). If you have multiple clouds,
    you can also give manual offset for the clouds in converter.

    there is also pointcloud2point mesh converter, it creates regular gameobjects with meshrenderer.
    so those you could easily load/disable/recycle/destroy/move around.

    and lastly, can of course contact me about any issues, as this sounds like an interesting project (to use for improving the viewer). and one more option is to hire me to do "expedited features for the asset store version" or custom features for your project only, although quite busy schedule these days..)
     
  9. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,408
    probably best videos are these 3 (few pages back in this thread),
    but note that they have added some extra functionality there:


    (i have point picking feature in the viewer, they have added those UI stuff, minimap and lines etc)


    if not mistaken, this was using the mesh version
     
    sjm-tech likes this.
  10. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,408
  11. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,408
    got couple nice features working (hopefully in the store within next 2-3 months..)
    - v2 binary format is coming (improved loading times. 50m rgb points, old format: ~3800ms, new format: ~350ms)
    - improved shaders (~5 fps increase with 50m rgb points)
     
    IsDon, sjm-tech and Rickmc3280 like this.
  12. boogerlab

    boogerlab

    Joined:
    Apr 22, 2013
    Posts:
    1
    Hey i got an error in 2019.1.2 'Graphics.DrawProcedural(MeshTopology, int, int)' is obsolete: 'Method DrawProcedural has been deprecated.
    This fix seems to work:
    //Graphics.DrawProcedural(MeshTopology.Points, totalPoints, instanceCount);
    Graphics.DrawProceduralNow(MeshTopology.Points, totalPoints, instanceCount);
     
  13. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,408
    thanks! ill add that for the next update.
     
  14. mam01

    mam01

    Joined:
    Jun 1, 2019
    Posts:
    3
    Greetings,

    Just installed the asset into a personal edition of Unity, release 2018.4.1f1. I have been trying to convert a big .pts file into .bin format; the conversion appears to work just fine, resulting in a 2.5GB .bin file. When I try to open it with @BinaryViewer, however, I get an error message related to the file size being greater than 2GB and the process will halt.

    The error message is as follows:

    "..... filename.bin cannot be opened with ReadAllBytes(), it might be too large >2gb UnityEngine.Debug:LogError(Object)"


    I am fairly new to Unity and while I have tried to dig through available documentation I have been unable to figure out whether this is a limitation of the personal edition or whether this may originate from the plugin. I have also gone through this thread as well as the plugin documentation, but found no remarks to this limitation, either.

    I would be sincerely grateful if somebody could share some light into this?

    Thanks,
     
  15. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,408
    Hi,

    That is limitation in the readallbytes,
    https://github.com/unitycoder/UnityPointCloudViewer/issues/1

    so current workaround is to split your cloud into 2 files, before converting.
    also in the next update, its possible to read files larger than 2gb.
     
  16. mam01

    mam01

    Joined:
    Jun 1, 2019
    Posts:
    3
    Thank you very much for the information.
     
  17. TCTomm

    TCTomm

    Joined:
    Jan 25, 2014
    Posts:
    2
    Hi @mgear

    is there any chance to get the latest version, that can process files over 2gb, seems like the current version is from late 2018?
    We are evaluating different options for point cloud rendering in VR very short term and I would appreciate very much to get in contact as soon as possible.

    Thanks a lot Thomas
     
  18. Rickmc3280

    Rickmc3280

    Joined:
    Jun 28, 2014
    Posts:
    189
    Or a standalone exe that could process it would be cool. Was playing with several clouds last night and needed that at least 4 times.

    On a side note... that many points would almost be unwatchable in VR unless you find a streaming solution.
     
  19. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,408
    yes, can you email/pm me the order number and your email where to send files.

    i'd also suggest testing the mesh converter version, since then you can process the cloud into large meshes (like millions of points per mesh), instead of creating single output file (which has the limit).

    and of course at some point it will be too slow to have that large amount of points at once,
    so then you would need to split it anyway.
     
  20. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,408
    yes, i'm thinking that amount would be too heavy for the binaryviewer, unless you split to smaller parts and use the dynamic resolution.

    btw. about the mesh splitting to grid, i have test version of that pretty much working, pm if you want to test it.
    i believe you were interested on that.

    commandline/standalone converter tool would be certainly possible and useful, i think ill need to make some test version of that.
     
  21. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,408
    las file has quite many different versions/structures, so there could certainly by issues depending on the format.

    standalone converter, sure, if you want to try, i can email the new file format structure, should be rather simple,
    could even use some external pcl importer to support different formats, and just dump point and color data out.

    current .bin (old) format is here https://github.com/unitycoder/UnityPointCloudViewer/wiki/Binary-File-Format-Structure
    its just raw binary, no compression or other advanced things yet. New format is slightly changed.
     
  22. TCTomm

    TCTomm

    Joined:
    Jan 25, 2014
    Posts:
    2
    This solution will most likely not work out of the box for us, since the original file is over 100gb ;-) we will have to find a way of reducing/separating anywa, but I want to look at different options. We have a short term goal, where a regular point cloud viewing software would probably the better approach and a longer goal of doing much more with the data, which might require a propper tessellation/conversion anyway. Not sure yet how we approach it.
     
  23. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,408
    yeah, that sounds like too many points to handle, even just to load it would take too long, not to mention trying to draw those.

    Is that the raw file or already filtered? Usually you would filter it with say 5-10mm filter to reduce points.
    I'm currently adding/improving the on-demand-loading and point count,
    so hopefully that would be useful for large clouds later.
     
  24. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,408
    go ahead
     
  25. Rickmc3280

    Rickmc3280

    Joined:
    Jun 28, 2014
    Posts:
    189
    Has anyone messed with raycasting the meshed version of the point clouds? I am trying to find the closest vertex coordinate, but I'm not quite sure that the raycast would hit a triangle, since it seems like the meshed version is not holding a lot of the other information? or would it?
     
  26. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,408
    basically the same code that is used for point picking in the dx11 version would work (since it simply does point to line check), ill try to add mesh version example for that in the next update.

    if you want to make your own quick test with unity api, could try bounds.intersectray, to get mesh,
    then iterate all points within that mesh to get closest to ray (or exact hit with some line to point intersection)
     
  27. Rickmc3280

    Rickmc3280

    Joined:
    Jun 28, 2014
    Posts:
    189
    I had tried this from the docs and modified it several times and in various ways with no luck.

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class rayCastHitScript : MonoBehaviour
    5. {
    6.     Camera cam;
    7.  
    8.     void Start()
    9.     {
    10.         cam = GetComponent<Camera>();
    11.     }
    12.  
    13.     void Update()
    14.     {
    15.         RaycastHit hit;
    16.         if (!Physics.Raycast(cam.ScreenPointToRay(Input.mousePosition), out hit))
    17.             return;
    18.  
    19.  
    20.         MeshCollider meshCollider = hit.collider as MeshCollider;
    21.      
    22.             if (meshCollider == null || meshCollider.sharedMesh == null)
    23.                 return;
    24.  
    25.         Mesh mesh = meshCollider.sharedMesh;
    26.         Vector3[] vertices = mesh.vertices;
    27.         int[] triangles = mesh.triangles;
    28.         Vector3 p0 = vertices[triangles[hit.triangleIndex * 3 + 0]];
    29.         Debug.Log("hit 1");
    30.         Vector3 p1 = vertices[triangles[hit.triangleIndex * 3 + 1]];
    31.         Debug.Log("hit 2");
    32.         Vector3 p2 = vertices[triangles[hit.triangleIndex * 3 + 2]];
    33.         Debug.Log("hit 3");
    34.         Transform hitTransform = hit.collider.transform;
    35.         p0 = hitTransform.TransformPoint(p0);
    36.         p1 = hitTransform.TransformPoint(p1);
    37.         p2 = hitTransform.TransformPoint(p2);
    38.         Debug.DrawLine(p0, p1);
    39.         Debug.DrawLine(p1, p2);
    40.         Debug.DrawLine(p2, p0);
    41.     }
    42. }
    but I think I will have to watch a bit more tuts.
     
  28. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,408
    that one requires collider as its Physics.Raycast()

    so you only want to check for bounds (to avoid checking all meshes in scene),
    and then iterate all vertices from the mesh which bounds you hit, to find closest vertex.
     
  29. Rickmc3280

    Rickmc3280

    Joined:
    Jun 28, 2014
    Posts:
    189
    Yeah, i had attached the colliders and all of that. Was the only way that I knew to be able to access the "triangle" from meshes. Is there a more efficient way to get point information from the mesh? My limited understanding is that rays dont get verts, only faces/triangles etc.
     
  30. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,408
  31. ToddDurant

    ToddDurant

    Joined:
    Jul 18, 2017
    Posts:
    3
    I have a pointcloud (.ply) file with uv's. Can I use a texture to change point colors? Thanks you!
     
  32. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,408
    no, uv's are not imported..
    (and in the included shaders uv's are either not used, or they are set to 0,0-1,1 to do circle clipping)

    i think might be able use meshlab to bake texture into vertex colors, but ive have never tried.
    or maybe blender can do also https://blender.stackexchange.com/q...ap-texture-to-vertex-color-selected-to-active

    actually, how or for what reason would you like to change the point colors using texture?
     
  33. ToddDurant

    ToddDurant

    Joined:
    Jul 18, 2017
    Posts:
    3
    Thank you so much for the reply! I'm investigating usage of pointclouds for viewing MRI data. I can bake colors/uv's etc into the points with meshlab/houdini using Potree, but I have not figured out a way to feed different point data to be able to view different datasets (highlighting different regions/atlas's/whitematter). Here is my work in Potree to get a sense of where I was headed: http://www.todddurant.com/BrainCloud.html
     
  34. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,408
    > "way to feed different point data to be able to view different datasets (highlighting different regions/atlas's/whitematter)"

    if you more info about that feature (what exactly it should do, or some step by step details), then i can check if its possible.
     
  35. ToddDurant

    ToddDurant

    Joined:
    Jul 18, 2017
    Posts:
    3
    My idea was to create a pointcloud sliced into 64/128/256 layers. Each layer would have its own set of UVs. Pointcolors would be determined from the assigned texture for each layer (cubemap with rgba). The texture cubemap would be generated from an outside program. ...hope that makes sense :)
     
  36. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,408
  37. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,408
    sjm-tech likes this.
  38. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,408
    working on the next update, point cloud split into "tiles":

    each tile can be culled, point count adjusted based on distance etc.
    unity point cloud tiles.gif
     
    LaserSaber, IsDon and sjm-tech like this.
  39. sjm-tech

    sjm-tech

    Joined:
    Sep 23, 2010
    Posts:
    734
    Awesome!
     
  40. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,408
    tested this with your cloud (141million points)

    full cloud in v2 format viewer:
    upload_2019-10-15_17-57-34.png



    full cloud in memory, with new tiles viewer:

    point "lods" (further tiles have less points *distance is adjustable, need to tweak it still)
    point cloud lodding.gif

    point culling (hides points)
    point cloud culling.gif
     
  41. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,408
    New stuff:

    External commandline tool to convert PLY files into v2 (*.ucpc) format. *later v3 format will be added.
    This will allow you to convert files outside unity, and since it uses external PLY importer, binary PLY files are also supported.

    Download:

    https://github.com/unitycoder/UnityPointCloudViewer/wiki/Commandline-Tools

    Examples:
    > plyconverter -input=yourfile.ply
    converts file to v2 and saves into same folder as input file (with *.ucpc extension)

    > plyconverter -input=yourfile.ply -output=c:/data/myfolder/
    converts, and outputs into that folder (with same filename.ucpc extension)

    > plyconverter -input=yourfile.ply -scale=0.1 -limit=10000
    converts, scales, and reads only first 10000 points (good for testing if scale is correct)

    > plyconverter -input=yourfile.ply -flip=yz
    converts, flips y & z values

    > plyconverter -input=yourfile.ply -flip=yz -offset=auto
    converts, flips y & z values, and autooffsets near 0,0,0 (same way like the binary converter does)

    Screenshot:
    upload_2019-10-19_23-10-15.png
     
    Last edited: Oct 22, 2019
    IsDon likes this.
  42. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,408
    NewStuff

    - Updated commandline PLY converter (to fix header bound values)
    - Added commandline LAS/LAZ converter (uses external las library, so should be more robust, and supports LAZ too)

    download links are here:
    https://github.com/unitycoder/UnityPointCloudViewer/wiki/Commandline-Tools

    These could be better than using runtimeconverter, since they are faster / more robust and accept more variation in the formats (ply ascii/binary, las+laz). For your runtime applications, you could experiment by calling these commandline tools to convert your raw data into v2 format and then loading that.
     
    Last edited: Oct 22, 2019
    sjm-tech likes this.
  43. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,408
    haven't tested yet, but in theory that could work.. should try with this,
    https://docs.unity3d.com/ScriptReference/Shader.SetGlobalVector.html
    and have float3 variable in shader, added to the vertex position.
     
  44. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,408
    Last edited: Oct 28, 2019
  45. TimElschner

    TimElschner

    Joined:
    Jan 29, 2014
    Posts:
    8
    I have an issue converting a .pts which was exported from recap pro to convert to a bin.
    There are appearing points from others depths on wrong positions. See image attached Anmerkung 2019-10-30 123236.jpg
    any ideas? It seems like a bug in the pointcloud2binary converter since the pts looks fine in other viewers.
     
  46. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,408
    hi, replied on email few minutes ago. (so probably need to file for testing)
     
  47. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,408
    coming in the next update, trying to push it live within a week or 2.

    those commandline tools are available now, they are only missing the randomize feature,
    and after that i'll add this new v3 tiles format output for them.
     
    Rickmc3280 likes this.
  48. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,408
    posting the info here for others also,

    so for *.PTS files, it must have that header row, with point count (that might not be enabled by default in CloudCompare export)
    upload_2019-10-30_19-58-44.png

    from cloud compare need to enable it: [x] number of points (separate line)
    upload_2019-10-30_19-59-12.png

    Otherwise the file is same as raw XYZ, no point count header row.
    (and having that header row makes importing faster, since it knows the point count right away)
     
  49. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,408
    Update Coming Soon(tm)

    with cancel button for most converter operations:
    upload_2019-11-2_23-41-3.png
     
    IsDon, Rickmc3280 and sjm-tech like this.
  50. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,408
    same view with LOD system enabled ~120fps
    upload_2019-11-8_10-30-25.png
    * Note: point size is increased to cover optimized points, also note that some stray point areas were optimized out (see bottom right corner bush, you can control this by specifying minimum point count per tile)
     
    IsDon, sjm-tech and Rickmc3280 like this.