Search Unity

[Released] Point Cloud Viewer Tools

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

  1. petrasvestartas

    petrasvestartas

    Joined:
    Aug 14, 2019
    Posts:
    13
    By assigning you mean writing new PointCloudViewerDX11() at the start, or do it in the inspector of unity without code?

    The .dll is Faro scanner sdk I wrote that runs scanner and sends data to pc, it is more hardware sdk.
     
  2. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,445
    do in inspector, or if want to use script,
    Code (CSharp):
    1. binaryViewerDX11 = GetComponent<PointCloudViewerDX11>(); // if its in the same gameobject
     
  3. petrasvestartas

    petrasvestartas

    Joined:
    Aug 14, 2019
    Posts:
    13
    After writing your line, and trying to debug by:
    Debug.Log("Binary viewer: " + binaryViewerDX11.ToString()); //this gets already an error

    I still get null error.
    How can I properly initialize viewer in my project.
    I just have you plugin folder in my assets. And the code I share before.

    What did I miss?
     
  4. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,445
    i'm checking in pm - will post solution here, receiving directly from device. (so could be scale or offset issue)
     
  5. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,445
    Looks like the main issue was just a wrong material in the viewer, needs to be one of those DX11 materials.

    (i know its easy to miss, since it doesn't cause any error messages)
     
  6. petrasvestartas

    petrasvestartas

    Joined:
    Aug 14, 2019
    Posts:
    13


    Thank you for the help, it is working fine:) The video is a bit slow, because loading clouds and cropping in the back takes time, but it does what i need.
     
    Rickmc3280 likes this.
  7. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,445
    nice, really interesting stuff.

    you could set the points array from another thread also,
    then that part wouldn't hang the main app. (if its takes long time)
     
  8. petrasvestartas

    petrasvestartas

    Joined:
    Aug 14, 2019
    Posts:
    13
    Thanks I will try to do that.

    There is another issue, when I minimize the unity window and the open in again, the cloud display is gone.
    Only when the new pointcloud is loaded in Display() method the cloud is shown again.

    Do you know how to solve this issue?

    Here is the video with the issue:
     
    Rickmc3280 likes this.
  9. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,445
    that happens if your project re-compiles (which can happen if your script saves/generates files inside the project folders),
    cant remember right now if there were some ways around it.. or if newer unity versions had some editor settings to stop compiling happening if its in playmode.
     
  10. TokyoWarfareProject

    TokyoWarfareProject

    Joined:
    Jun 20, 2018
    Posts:
    814
    so I tried again with the big cloud, opened in Cloud Compare, converted to .Ply Ascii and almost managaed to convert to V3 using edior converter
    upload_2019-12-29_20-6-38.png
    but then out of mem :\ arrrrrggg

    I should have kept internet browser closed.

    The comand line tool says at least on github .ply converter doest not convert to v3

    It would also be cool that the tool did cache all previous work because not launching conversion again will take hours.
     
  11. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,445
    alt tabbing can cause issues, since unity might start importing those files (unless you use the .(dot) in the folder name)

    that should be solved by writing output files while still converting, then it could even continue from previous point index actually. (need to test that)
     
  12. TokyoWarfareProject

    TokyoWarfareProject

    Joined:
    Jun 20, 2018
    Posts:
    814
    Ok so I did re- run the job and it did just "finish" this time

    Oh step 4/7 it finished the task and in the info field it showx "(Converter ) Timer:6299642ms

    generated the .pcroot file but its only 1kb file

    ok checking the console I find theese:
    Code (CSharp):
    1. (v3 converter) Done : Assets\converted\York_AO_merge - Cloud.pcroot (skipped 78052144 nodes with less than 10000 points)
    2. UnityEngine.Debug:Log(Object)
    3. unitycodercom_PointCloud2Binary.PointCloud2BinaryConverter:ConvertBinaryV2() (at Assets/PointCloudTools/Editor/PointCloud2BinaryConverter.cs:1626)
    4. unitycodercom_PointCloud2Binary.PointCloud2BinaryConverter:OnGUI() (at Assets/PointCloudTools/Editor/PointCloud2BinaryConverter.cs:233)
    5. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

    Code (CSharp):
    1. Actually, no tiles found! You should probably enable scale values to make your cloud to smaller size? Or make gridsize bigger, or set minimum point count smaller.
    2. UnityEngine.Debug:LogError(Object)
    3. unitycodercom_PointCloud2Binary.PointCloud2BinaryConverter:ConvertBinaryV2() (at Assets/PointCloudTools/Editor/PointCloud2BinaryConverter.cs:1630)
    4. unitycodercom_PointCloud2Binary.PointCloud2BinaryConverter:OnGUI() (at Assets/PointCloudTools/Editor/PointCloud2BinaryConverter.cs:233)
    5. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
    6.  
    Code (CSharp):
    1. (Converter) Timer: 6299642 ms
    2. UnityEngine.Debug:LogFormat(String, Object[])
    3. unitycodercom_PointCloud2Binary.PointCloud2BinaryConverter:ConvertBinaryV2() (at Assets/PointCloudTools/Editor/PointCloud2BinaryConverter.cs:1638)
    4. unitycodercom_PointCloud2Binary.PointCloud2BinaryConverter:OnGUI() (at Assets/PointCloudTools/Editor/PointCloud2BinaryConverter.cs:233)
    5. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
    6.  
     
  13. TokyoWarfareProject

    TokyoWarfareProject

    Joined:
    Jun 20, 2018
    Posts:
    814
    May be my cloud is not scalled? that would be odd tho I thought it was , tbh I can´t confirm for this one
     
  14. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,445
    also test with limited point count enabled, with v2 format to quickly see if its in scale.
     
  15. TokyoWarfareProject

    TokyoWarfareProject

    Joined:
    Jun 20, 2018
    Posts:
    814
    so I checked again:
    upload_2019-12-29_22-22-3.png

    1km for that cloud seems legit.

    theese where my settings
    upload_2019-12-29_22-22-56.png

    I understand that settings say that on a 100mx100m like grid need to be at least 10k points which for the density should
     
  16. TokyoWarfareProject

    TokyoWarfareProject

    Joined:
    Jun 20, 2018
    Posts:
    814
    MAy be is an axis issue, like in CC the upwards is the blue axis, sadly I can´t find what axis blue represents in CC
     
  17. TokyoWarfareProject

    TokyoWarfareProject

    Joined:
    Jun 20, 2018
    Posts:
    814
    I tried to convert with an small ammount 1M and I see nothing but a black small cube, tried to scale up or flip yz but nothing seems to work, also .las seems to be no longer supported by the builting converter
     
  18. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,445
    can you print out few lines from the data? (can use the header viewer tool)

    builtin converter supports las to v1 only at the moment.
     
  19. TokyoWarfareProject

    TokyoWarfareProject

    Joined:
    Jun 20, 2018
    Posts:
    814
  20. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,445
    that works, what i did:
    - open in cloudcompare, do the global shift it suggests, but disable [ ] preserve on save
    - export as pts (export settings)
    - binaryconverter convert to v2 or v3 cloud (enable YZ flip, no scaling)
     
  21. TokyoWarfareProject

    TokyoWarfareProject

    Joined:
    Jun 20, 2018
    Posts:
    814
    Ok I see in console it loads ok, but in game view it is not working, for later on realice I was using the 2019.3 b12 so its probably this.
    I'm too tired to try now on older unity will test tomorrow.
     
  22. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,445
    ^ checking in pm.


    Also got some interesting v3 feature updates finished:
    - Load Tiles On Demand (previously all tiles were loaded into memory, now it only loads them when they become visible - although they are still kept in memory for now)
    - Distance Priority Loader (Load tiles near player first, previously it started loading tiles based on the distance to 0,0,0)
    - Adjustable GPU Upload Rate (Reduce or eliminate spikes during loading and initialization -screenshots below)

    Before: (if loaded large tile with lots of points, big spike, because that unity feature cannot be used from other threads)
    upload_2020-1-1_13-51-0.png

    After: (smart gpu initialization, spread across frames, no huge spikes)
    upload_2020-1-1_13-51-46.png
     
  23. TheCircadian

    TheCircadian

    Joined:
    Jul 30, 2016
    Posts:
    16
    Hey, this is an awesome project!
    I'm working on a demo in SteamVR, and I'm hoping to select the points to measure distances using a VR controller. When I add
    using PointCloudViewer;
    to the SteamVR_LaserPointer.cs file it throws an error saying "The type or namespace name 'PointCloudViewer' could not be found". Do you have any idea why this may be?
     
    Rickmc3280 likes this.
  24. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,445
    actually noticed that the namespace is still the old one, so need to add this on top:
    Code (CSharp):
    1. using unitycodercom_PointCloudBinaryViewer;
    and then can reference viewers:
    Code (CSharp):
    1. public PointCloudViewerDX11 viewer;
    for measuring/point picking, see example scripts: PlaceMarkers.cs and MeasurementManagerV2.cs
     
  25. MartinProchazka

    MartinProchazka

    Joined:
    Apr 24, 2015
    Posts:
    8
    Hello mgear, my vote for next feature is manipulating (move,rotate,scale) with pointclouds in editor mode also for static and dynamic ones :)
     
  26. TheCircadian

    TheCircadian

    Joined:
    Jul 30, 2016
    Posts:
    16
    Thanks! Ended up getting it working by adding
    using Valve.VR;
    into the MeasurementManagerV2.cs file.
     
  27. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,445
    Some testing news:
    - unity 2019.1 version and later can use NativeArray (which means can release memory for V3 tiles if they are too far)
    - Point cloud area selection (for v1 and v2 viewer first), using 5 or more points to generate convex hull selection box and it returns list of points (image below)
    upload_2020-1-14_23-7-8.png
     
    Rickmc3280, IsDon and sjm-tech like this.
  28. Rickmc3280

    Rickmc3280

    Joined:
    Jun 28, 2014
    Posts:
    189
    When I create a mesh from point cloud, there is no ability to save the data for later (if I want to removed it from the scene) is that the case, or is there an issue on my end?

    Would it be because I am using the grid(beta) option? I had tried saving the mesh as a prefab, but in the meshfilter, it is empty, as well there is no place in the folders where any objects, assets, etc were generated.

    Edited to add

    I did get this error message which is tied to the shader it seems:


    Failed getting triangles. Submesh topology is lines or points.
    UnityEditor.Build.BuildPipelineInterfaces:OnSceneProcess(Scene, BuildReport)
     
    Last edited: Jan 30, 2020
  29. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,445
    ok, yeah that seems to be missing feature, should be easy to add for next update:
    https://github.com/unitycoder/UnityPointCloudViewer/issues/70
     
  30. Rickmc3280

    Rickmc3280

    Joined:
    Jun 28, 2014
    Posts:
    189
  31. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,445
    certainly within february, have those previous features working, and few other fixes+updates pretty much ready to go.

    *i can send you the meshconverter separately once its done
     
  32. mam01

    mam01

    Joined:
    Jun 1, 2019
    Posts:
    3
    I will be looking forward to this upcoming update. Just wanted to say that I am finding the pluging extremely useful for my purposes and workflow, and I for one appreciate and keep coming back to check the regular updates. Finally managed to import big (ca. 150M points) data files thanks to the v2 format and the latest revision of LASConverter, and here's hoping to be able to convert bigger sets in the future, if that might be an option. Great plugin!
     
    IsDon likes this.
  33. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,445
    thanks!
    the latest LASConverter (v1.3) should allow huge clouds to be converted,
    but need to use V3 tiles format (or multiple V2 viewers).
    as the V2 loads points into single array, and there is C# limit of ~2gb for array size or so.

    and always post ideas / requests so i can look into those.

    *Updated commandline converter to 1.4, can now process even bigger clouds.
     
    Last edited: Feb 1, 2020
  34. projectprogramamark

    projectprogramamark

    Joined:
    Jul 15, 2019
    Posts:
    4
    Hi! This pointcloud library looks great. Had a couple of questions though. Does it come with the source? And if so, is it structured such that it would be easily extendable? I'm specifically looking into manipulating individual points from the pointcloud for things like interaction and animation. Thanks!
     
  35. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,445
    yes, its all c# (no dll's), although i wouldn't say its easy to extend just like that,
    as some of the methods and variable names are not really "clean".. but there are many example scenes, and can ask how to do something.

    For your into, there are 2 ways of using this plugin:
    (A) convert point clouds into DX11 shader rendering:
    To work with those points, there are examples for point picking,
    creating point cloud from your own data (vector3 arrays for positions and colors),
    checking collision with pointcloud vs bounds etc.

    (B) Convert point clouds into regular Unity meshes (using point rendering): those meshes you can use easily (like move vertices yourself etc, and of course could use regular mesh shaders here, to move points based on player distance etc)

    And actually one other way is to playback animated point clouds,
    recorded & exported from Brekel kinect capture.
    (its just a frame by frame data, which is then displayed using points)


    if you have example images/videos of how the points should be interacted and animated, i can say if its easy to do.
     
  36. Pascal-

    Pascal-

    Joined:
    Mar 23, 2013
    Posts:
    32
    Dear All,

    What would be the best process to use rgb clouds exported originally as e57 series of files?
    Thanks a lot in advanced,
    Pascal
     
    Last edited: Feb 13, 2020
  37. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,445
    can use CloudCompare or FaroSceneLT to convert into some of the supported formats.
     
  38. Pascal-

    Pascal-

    Joined:
    Mar 23, 2013
    Posts:
    32
    Thank you!
     
  39. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,445
    submitted v2.30 update to store just now.

    (*with big thanks for @TokyoWarfareProject and @Rickmc3280 for ideas and testing)

    Contains many performance and feature updates for v3 tiles format.

    *Note that recommended conversion tool for creating V3 clouds is the command line Las Converter: (editor converter doesn't have support for: packed colors, skip points, keep points, huge clouds)
    https://github.com/unitycoder/UnityPointCloudViewer/wiki/Commandline-Tools


    Full update notes:

    - Feature: (V3) Load Tiles On Demand (previously all tiles were loaded into memory, now it only loads them when they become visible, and with needed amount of points, then reloaded if need more points)
    - Feature: (V3) Distance Priority Loader (Load tiles near player first, previously it started loading tiles based on the distance to 0,0,0)
    - Feature: (V3) Adjustable GPU Upload Rate (Reduce or eliminate spikes during loading and initialization)
    - Feature: (V3) Added public GetVisibleTileCount() and GetVisiblePointCount() methods to V3 viewer (see example script ViewerStats.cs)
    - Feature: (V3) Added global tile resolution (visible_points*this_value=new amount) *Note: Camera needs to be rotated around to refresh tiles
    - Feature: (V3) Added global point size multiplier (original_pointsize*this_value=new size) *Note: Camera needs to be rotated around to refresh tiles, Requires separate shader which has SizeMultiplier property (PointCloudColorSizeDX11v2b.mat)
    - Feature: (V3) Added optional ForceGC checkbox (calls GC.Collect() after file operations, to release some temporary arrays, helps more when using NativeArrays in 2019.x)
    - Feature: (V3) Added support for Packed Colors (Use CommandLine LAS converter to generated packed color data)
    - Feature: (V3) Added support for NativeArrays (Allows disposing memory for far away tiles. Requires Unity 2019.1 or later)
    - Feature: (v1, V2) Added Area selection example (select points inside hull)

    - Added: PointCloudColorSizeDX11v3-packed.mat and shader (to be used with v3 packed color data)
    - Added: Link to github wiki documentation page
    - Added: Random cloud generator: add .PTS format, cleanup UI

    - Changed: Moved some wip/experimental DX11 shaders under PointCloudTools\Shaders\DX11\Extras\
    - Changed: Moved some wip/experimental Mesh shaders under PointCloudTools\Shaders\Mesh\Extras\

    - Fixed: Obsolete/Deprecated warnings in 2018.x/2019.x https://github.com/unitycoder/UnityPointCloudViewer/issues/67
    - Fixed: (V3) Tiles not visible until rotate camera https://github.com/unitycoder/UnityPointCloudViewer/issues/66
    - Fixed: Mesh Converter not saving meshes if used [x] split to grid https://github.com/unitycoder/UnityPointCloudViewer/issues/70

    Latest updates/issues:
    - https://github.com/unitycoder/UnityPointCloudViewer/issues
     
    IsDon, Rickmc3280 and sjm-tech like this.
  40. flying_taiwan

    flying_taiwan

    Joined:
    Jul 19, 2018
    Posts:
    3
    Can those points in the box be hide?
    I would like to create a box to hide points outside the box.
     
  41. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,445
    That area selection has 2 "modes":
    - overwrite colors on existing point cloud
    - create new cloud from the selected points (so i guess you could use this one, and disable the original cloud then)

    alternative solution,
    create custom shader to only draw points within given box coordinates.. (but not available in the plugin yet)
     
  42. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,445
    HeadsUp notice:
    End April there is some Asset Store Spring Sale coming, i'll probably include PointCloudViewer on that sale.
    (so it could be 50% off during that time, in case someone is considering buying - i got this invitation just now, so couldn't post earlier)
     
    Rickmc3280 and IsDon like this.
  43. Choquergu

    Choquergu

    Joined:
    Oct 23, 2019
    Posts:
    2
    Hi,
    Just purchased your plugins, as we are trying to visualise a.pts file in Unity 2019.2.2. I'm encountering a parsing error when trying to convert this pts to a bin . As i already experimented importing this files by homemade script, I guess it could be the first line being a point counts ( and not describing 7 value as expected) , but I do not see a option alowing to filter the first line.

    Autodesk recap, & my own script are able to import the file and exploit at least the point coordinates so am i missing a setup or an option ?

    Edit: in fact it's linked to my localisation option being france/latin, so it search for a comma separator instead of a point, is it configurable somewhere ?^

    Edit² : Buntly adding "Thread.CurrentThread.CurrentCulture = new CultureInfo("en-us");" before the PTS conversion seems to has solved this problem, in case of anyone encountering a similar culture info relating parsing error.
     
    Last edited: Mar 25, 2020
    Rickmc3280 likes this.
  44. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,445
    yes, its related to this unity 2019.x change on how localization is handled
    https://forum.unity.com/threads/pre...ad-of-dots-as-separators.847978/#post-5598706

    i'll pm you the latest test version to try soon. (its not in store yet)
     
  45. Vick115

    Vick115

    Joined:
    Jan 22, 2020
    Posts:
    8
    Good morning

    I just purchased the package and am really excited to get started. I went to the quickstart to learn how to do this. Step 1 I went to the window and opened the PointCloud 2Binary, got it.
    Step 2 Drag&Drop your point cloud file from Project window into the "Point Cloud source file" field.
    How do I import my point cloud into Unity to get it in the project window? I can't just import asset? I cant go to explorer and drag and drop my pts file into the source file, that didn't work.

    5 minutes in and I am stuck here.
     
  46. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,445
    Updated the quickstart page just now,
    https://github.com/unitycoder/UnityPointCloudViewer/wiki/Quickstart

    So in short,
    to view point cloud files, need to convert them into custom format (or meshes) inside unity, after that the original raw cloud file can be deleted from project.
    And that is done by copying point cloud file inside the project, so that its visible in Assets/
    Then from there can drag & drop into converter source field.

    There is also runtime viewer available, where you can view raw files, like .pts, without converting
    (example scene "PointCloud-RuntimeLoader.scene", but its slower since it needs to parse the file on load).

    Also possible that you have same .pts comma/dot issue as the other user few messages up,
    are you using 2019.x or later?
     
    IsDon and Vick115 like this.
  47. Vick115

    Vick115

    Joined:
    Jan 22, 2020
    Posts:
    8
    Thanks for the reply
    I am using Unity 2019.3.5f1, I was able to bring my pts file into Unity following the steps you laid out. I converted the pts file to binary with the RGB selected and the use VR.ucpc format.
    I opened the scene PointCloud-BinaryLoaderV2 and clicked on the BineryViewer. I cannot drag my.ucpc file from Streaming assets into the Binary Source File slot. Its not taking it.
    Should I be using a different version of Unity?
     
  48. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,445
    ok almost there, need to type the filename manually, cannot drag that part in.
    So if your file is inside StreamingAssets/, no need to type the full path, just put "yourfilename.ucpc"
    and the plugin checks if that file exists inside StreamingAssets.

    (alternatively can enter full path if the file is somewhere else, it doesnt have to be inside Unity project, as in c:\files\stuff\project1\Assets\StreamingAssets\yourfilename.ucpc)
     
  49. Vick115

    Vick115

    Joined:
    Jan 22, 2020
    Posts:
    8
    I'm am seeing something but its so far out in space. how do I get my camera in the point cloud?
    Thanks for taking the time to help me, this would be a huge thing to get correct.
    I am an old laser scanner, I was involved with it early on. My tasks these days is modeling laser scan data In an intelligent format such as Plant 3D or Inventor.
     
  50. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,445
    then might need to set scaling in the converter settings (usually 0.001), as in unity it expects meters as units.
    and [x] auto-offset near zero should be enabled (to offset point cloud near 0,0,0 coordinate)