Search Unity

[Released] Point Cloud Viewer Tools

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

  1. Rickmc3280

    Rickmc3280

    Joined:
    Jun 28, 2014
    Posts:
    189
    By the way, I found this for URP. Seems like you dont need the custom render feature anymore. VR cloud works for me now.

    I renamed the function back to OnRenderObject and it gets called now.
    upload_2022-6-29_15-59-43.png

    ***EDIT***

    Still need the CustomRenderPass because of the thing, but good to know that OnRenderObject can be fixed.
     
    Last edited: Jun 30, 2022
    mgear likes this.
  2. Rickmc3280

    Rickmc3280

    Joined:
    Jun 28, 2014
    Posts:
    189
    Althought, it still does the thing.
     
  3. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,411
    Tip:
    You can use Unity Occlusion culling (baked) with v3 tiles viewer (so tiles behind objects wont get drawn)
    https://github.com/unitycoder/Unity...V3-Tiles-Format#using-unity-occlusion-culling
    *Doesn't always improve performance, but can try on your scenes.

    Quick sample images, when looking at building roof directly, tiles behind get hidden.
    (those mesh planes are generated in CloudCompare, not accurate here, just a quick test from low resolution cloud)

    Occlusion Culling Disabled: cpu ~32ms
    upload_2022-7-12_12-39-37.png
    ---
    Occlusion Culling Enabled: cpu ~15mc *best case scenario, when other tiles are behind that roof plane
    upload_2022-7-12_12-38-55.png
     
    Last edited: Jul 18, 2022
    Rickmc3280 likes this.
  4. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,411
    sjm-tech and code-blep like this.
  5. BoxingHedgehog

    BoxingHedgehog

    Joined:
    Feb 1, 2022
    Posts:
    3
    Hello. I recently bought your package and after a bit of effort, I got it to work on a number of my datasets (I have dozens of TLS and drone sets). I have to say it's very impressive and I'm very happy with the purchase. But sometimes, I can't get the dataset to display (this is on the TLS files and if I have edited the drone photogrammetry data to remove stray points). The data appears to load and the bounding box appears in the project window at the origin, but the points don't display. I'm using V3 and the external converter. The files appear to have been successfully converted. The pct files appear and have data in them, so I expect it's some rookie mistake I'm making. I'm hoping you may have seen this before and could save me some time experimenting.
     
  6. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,411
    if possible, can you send me those converted files? (or source files to test)

    other things to check:

    - view distance from upload_2022-8-6_12-38-8.png
    - camera view distance
    - correct material is assigned to viewer? for example the default "PointCloudColorSizeDX11v2-Example-V3.mat"
     
  7. BoxingHedgehog

    BoxingHedgehog

    Joined:
    Feb 1, 2022
    Posts:
    3
    Thanks for your quick response. I have checked those settings and still no joy. I'm happy to share any of the LAS or converted files with you. How can I get them to you?

    My gut is telling me it's something to do with my export from Cloud Compare, because prior to editing one of the files it's visible in Unity, but after editing it isn't. But both the pre-edited and post-edited las file is visible in CC. Perhaps these would be the files to share.
     
  8. BoxingHedgehog

    BoxingHedgehog

    Joined:
    Feb 1, 2022
    Posts:
    3
    I have worked this out. It was a rookie mistake. My camera in unity was not oriented towards the point cloud and so the points were not visible in the scene window.
     
    mgear likes this.
  9. monomomo

    monomomo

    Joined:
    Nov 17, 2020
    Posts:
    1
    Hello, I am hoping you can help me with a beginners question. I am looking for a point cloud solution that allows me to use lighting on imported point clouds (have been doing this in UE but I am moving to Unity). Is this possible with your package? What kind of conversion would be necessary? Any tip would be highly appreciated. Thank you!
     
  10. WayneVenter

    WayneVenter

    Joined:
    May 8, 2019
    Posts:
    56
    I can't find a way to create prefabs or store the converted meshes. I save/export the PC from CC, then process it with PointCloud2Mesh, this adds the meshes to the scenes, but if I drag to create a prefab the Mesh Filter is empty.
    Here is the image post convert.
    upload_2022-9-27_9-32-31.png

    Next I would drag the collection, make a prefab, then create a new scene and drag the prefab back it, but now there is no mesh data.
    upload_2022-9-27_9-35-38.png

    How can I export or store my meshes?
     

    Attached Files:

  11. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,411
    ok ive seen that before, which unity version you are using?

    i think one workaround was to save and export the scene (with the meshes),
    but i'll check whats the issue.
     
  12. WayneVenter

    WayneVenter

    Joined:
    May 8, 2019
    Posts:
    56
    I'm using 2021.3.10f
    The way I get around it is to do the convert without adding the the "add to scene", then manually copy the mesh files, then do the same process again and manually drag/link the mesh files from previous step. Obviously this is not ideal :)
     
  13. adidmaro

    adidmaro

    Joined:
    Mar 14, 2017
    Posts:
    3
    Hello mgear,
    I've successfully converted my point cloud data into meshes and using the AndroidColorSize shader, as shown in your androidHeavy example, I am able to display my point cloud data in Oculus Quest 2. Unfortunately, I can't adjust the "PointSize property in the shader. I've tried other shaders in the /Mesh/ folder and found that "PointSize" is also not modifiable. Is there any way around this?
    I need to reduce my point cloud size and having a small point size make makes my object less visible if I reduce the point numbers, therefore I need a bigger point size to compensate for this.

    I am using unity 2020.3.20 with URP for the development
     
  14. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,411
    by "not modifiable", do you mean:
    (1) cannot change the value in editor inspector or (2) cannot set size from script,
    or (3) it doesn't affect point size in editor or (4) in build?

    for me this works,
    upload_2022-9-29_16-29-33.png
     
  15. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,411
  16. adidmaro

    adidmaro

    Joined:
    Mar 14, 2017
    Posts:
    3
    I can change the PointSize value in the inspector and through a script, but it doesn't affects point size in the editor or build. At some builds, it won't even render, even though there are draw calls. Here I use the demo Scene_mobile_heavy01, and try to change the PointSize. The size in shader properties does not correspond to the size of the point in the editor. Are there some settings that I'm missing? I'm currently only following the procedure of converting point cloud to meshes.
    upload_2022-9-29_17-21-35.png
     
  17. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,411
    In editor pointsize is not supported for DX11, if you are in Windows, can start editor with -force-glcore parameter, to use opengl, https://docs.unity3d.com/Manual/EditorCommandLineArguments.html (then can see point size in editor)

    For builds, tested OpenGL3.0 recently, which one you are using for the graphics api?
    upload_2022-9-29_18-34-10.png

    Also note, just noticed this bug with SRP Batcher, so disable that one:
    https://github.com/unitycoder/UnityPointCloudViewer/issues/136
     
    adidmaro likes this.
  18. adidmaro

    adidmaro

    Joined:
    Mar 14, 2017
    Posts:
    3
    Thank you for the response. I just realized that I'm running on DX11. When Running openGL, I could see the changes in Point Size in the editor but won't render the point cloud in my quest 2 build. This might be caused by changing the project settings, which I can no longer track. So I restart my PC and followed by creating a fresh project, and the point cloud is now shown in my quest 2 Build.

    In case anyone is interested, I'm using Ca. 3 M Point Clouds in the project, and I get a paltry 30 FPS in Quest 2
     
  19. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,411
    nice!

    You can try if enabling these help,
    [x] sort by x axis
    [x] split to grid
    [x] create lods

    that should help having less visible points, combined with shorter view distance.
    (so that further away cells get culled out by view distance or lod)

    https://github.com/unitycoder/UnityPointCloudViewer/wiki/PointCloud2Mesh

    Also, smaller point size is usually faster.
     
  20. seongbeeen

    seongbeeen

    Joined:
    Mar 2, 2022
    Posts:
    2
    Hello, I have some question.
    My point cloud file format is xyz and the whole point cloud is about 3 billion points.
    It takes so many time and lagging that controlling the viewer.
    How can I fix it?
     
  21. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,411
    - Use external converter, convert to V3 format (video example)
    - Adjust settings in V3 viewer: (play with those values) upload_2022-9-30_10-5-48.png
    - Smaller point sizes help also
    - Or if nothing helps, Filter point cloud in external tools first (to reduce point count)
     
    seongbeeen likes this.
  22. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,411
    Do you mean actually merge into single .las file,
    or import (convert) multiple .las files into this viewer (as a single cloud to view) ?
     
  23. seongbeeen

    seongbeeen

    Joined:
    Mar 2, 2022
    Posts:
    2
    Thank you for your reply! ^^
    I conveted V3 format.
    But I have another problem in my project.
    My project's pointcloud count is about 3~4 billion.
    And my pc's memory is 128gb.
    When I rendering all point, my pc's memory has an error (outofmemory).
    In Your example video (
    ),
    there has no problem in 64gb memory.
    How can I solve it...?
    When I add more memory, will it be solved?

    This is my pc environment
    os : Windows 10
    CPU : Intel xeon w-3265
    GPU : RTX A6000
    GPU VRAM : 48gb
    RAM : 131072mb
     
    Last edited: Oct 21, 2022
  24. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,411
    somethings to check:
    - check if single tile has too many points, then need to reduce gridsize (from the *.pcroot file, can see how many points on each tile https://github.com/unitycoder/Unity...-Structure#custom-v3-tiles-pcroot-and-pct-rgb )
    - does it happen in editor or build (if in build, check that its 64bit build)
    - if happens in editor, check editor.log (share here to send in private message/email)
    - check that you have [x] use Native arrays and [x] release tile memory
    - test if reducing view distance helps (then it means too many large tiles in view at the same time)
    - try using Packed format, then it should use 50% less memory
     
  25. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,411
    TokyoWarfareProject and sjm-tech like this.
  26. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,411
    Tested heavy point cloud (v3 tiles viewer) in VR
    (2021.2.7f1 + hdrp 12.x + Oculus+link cable in editor)


    SinglePass Instanced (new v2 VR shader)
    upload_2022-11-4_15-13-8.png

    MultiPass (original v2 shader)
    upload_2022-11-4_15-13-21.png
     
    sjm-tech likes this.
  27. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,411
    Preparing next update to store (uploading within December)

    Just added one other update to v3 viewer point picking (measuring):
    - Now more accurate (if need to pick exact points)
    - Uses 2 threads instead of 1 (~2x faster picking speed)
    - Can adjust pointPickingResolution (iterate all points or only every x:th point, For dense clouds can easily use 10 or more, so its 10x faster picking)
     
    sjm-tech likes this.
  28. tree_arb

    tree_arb

    Joined:
    Dec 30, 2019
    Posts:
    323
    Working great!

    I noticed the collision demo only supports V2. I'm about to try and modify it for v3 is that something you plan to include?

    Do you know if there is a way to read the GPS coordinates from .laz files? I think data is supposed to be in the header but I cannot read the header with the header tool (binary vs acsii i guess?)
     
  29. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,411
    collision in v3:
    Haven't thought about that, i'll have a look for what it might need.
    How you would use the collision? (not for throwing objects i'd guess)

    laz gps:
    if you look void LASConverter() inside PointCloud2BinaryConverter.cs, i skip most of the LAS header data,
    so if its there, could modify that part to read it. (or better: take my header parsing code to your own script and use that for gps reader).
    https://gis.stackexchange.com/a/132049

    Header tool is currently meant for quick header peek only, not full info viewer. (and doesnt support binary formats yet)
     
  30. tree_arb

    tree_arb

    Joined:
    Dec 30, 2019
    Posts:
    323
    Thank you very helpful.

    Ultimately I will be using collision to detect and editing specific point color and locations. I am new to your asset but I imported a large point cloud and used the collision cube like a lightsaber to erase and/or detect and change color of specific points.

    I tried a few tools yours seems to be the most useful to me so far but I'm realizing i clearly need to use v3 loading with large datasets, thus I must scrap my collision color changing lightsaber in v2
     
  31. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,411
    made some quick tests, so its possible to set color or remove (basically move points far away),
    using box collider as selector.

    But one issue:
    If you move away and come back, points could be loaded back again, if have enabled the [x] releaseTileMemory).. so this might not work well.

    Could save the modified points back into file, but not sure if causes other issues and it would be permanent edit..
    Also for really large/dense tiles, it would still be slow (runs currently in mainthread..)

    But let me know your comments, or if you want to test this version and see what happens?
    Let me know you unity version then also.

    upload_2022-11-19_18-2-43.png
     
    tree_arb likes this.
  32. tree_arb

    tree_arb

    Joined:
    Dec 30, 2019
    Posts:
    323
    Oh yes I would love to test the version! I am not at my office but I believe I'm on unity 2021.3.11f1 or 3.12f but that version is not set in stone for me

    I'll send you an email, I am the person who emailed you my invoice a few days ago and you sent me the patch for the mesh generator
     
  33. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,411
    ah ok, ill send it there during next week.

    i think with some effort should be possible for you to add "override" bool in the tile data,
    so then it loads modified file instead of original. (that would solve the permanent tile editing issue)
    same system would then allow reverting modified tile to original data.
     
    tree_arb likes this.
  34. tree_arb

    tree_arb

    Joined:
    Dec 30, 2019
    Posts:
    323
    Is there any way to put the viewer in a container that can be moved? moving the coordinates of the game object or parent has no effect.

    edit: oh i see there's some shader magic happening there

    Apologies for the multiple questions but I cannot get the convert point cloud to unity meshs to work, I've tried all the mesh shaders, different unity version. I'm trying to convert from laz and it seems to read the data and make a sizable file but the mesh is always blank.

    So, what I do have working well is the dx11 version with V3 dynamically loading the tiles and performance is actually quite acceptable on my target device.

    Perhaps you can advise me:

    I'm trying to decide if need to go mesh route or not. As is right now, DX11 v3 loads a batched folder and runs good. I can detect individual points, location, and color based on collision which is what I need.

    It is feasible to build a large project off the DX11 viewer version (In which case the only missing component is I need to shift the entire viewer coordinates at runtime.

    or

    For large projects is this just crazy and really needs to be in mesh format: If so, can a converted mesh's verts be detected with collisions to check specific points/colors the same as the DX11 version can?
     
    Last edited: Nov 22, 2022
  35. PascalHc

    PascalHc

    Joined:
    Nov 19, 2018
    Posts:
    2
    Hello,
    i have two suggestions.
    Can you please add namespaces or 'using >namespace<' to the following scripts:
    upload_2022-11-22_12-39-3.png

    And the second:
    Can you please add ' #if Unity_Editor ' at the beginning and ' #endif ' at the end of these four files? (The Editor folder solution does not work because there are some references i think; Maybe its just me, but i guess it wouldn't break anything and work safely for everyone then)
    upload_2022-11-22_12-42-24.png

    Thanks in advance!
    Pascal
     
  36. mgear

    mgear

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

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,411
    yes, that requires using the different shader (PointCloud_DX11_ColorSizeV2-TranslationMatrix.mat)
    and enabling this upload_2022-11-22_15-57-0.png
    but wont work in V3 viewer, since it uses that fixed tiled grid..

    Usually its issue with scale or offset, usually this should be enabled (unless points are not too far from 0,0,0 already)
    upload_2022-11-22_15-58-3.png

    If you try to convert LAZ file inside the editor converter to mesh, that doesn't work, so try .LAS.
    (seems to be missing error message from bad file extension, as it tries to read regular point data from "generic file" then)

    if you need to shift coordinates at run time, then currently mesh version (or v2 is only way to do that)..
    not sure yet how do i go adding that feature into v3 viewer, as it would require bigger "refresh" on the values..

    mesh version is slower, so you'd have to play with view distance values, can try the lods.
    and point picking there is not possible, so would have to look for generic "pick vertices from mesh without colliders" from asset store or github.
    mesh point pickling has been listed here https://github.com/unitycoder/UnityPointCloudViewer/issues/118
    havent tested it yet, but in theory it would be possible to make similar point picking like in the regular viewers (v2/v3)
    just by iterating the mesh points into those arrays..

    mesh version has the advantage that you can then easily enable/disable mesh parts yourself anyway you want..(as they are just gameobjects), and using unity occlusion culling might work there too.
     
  38. tree_arb

    tree_arb

    Joined:
    Dec 30, 2019
    Posts:
    323
    wow thanks for the detailed response. This asset is really quite impressive. Ok so if mesh is generally slower I wont even bother for this project. Yes I was trying to convert .laz to mesh inside editor that was my issue.

    Currently I have v3 loading a large folder of pcroot converted from laz and performance is great so ill stick w that.

    My personal reason for the need to reposition the cloud with v3 was because some of the 3rd party map SDKs scroll the map data, keeping the camera at 0,0,0. I wanted to tie the dx11 viewer to that, but instead I have solved that inside the maps sdks cameras. So all is good now :)

    thanks! looking forward to the December release
     
  39. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,411
    tree_arb likes this.
  40. tree_arb

    tree_arb

    Joined:
    Dec 30, 2019
    Posts:
    323
    So the stand alone converter, I can successfully convert laz to pcroot but depending on the grid size i may end up with missing .pct files

    I can send you a file with instructions if you want, but basically some .pct files are missing but they are referenced in the pcroot file when i view the written lines. This of course causes a loading error.

    depending on the source laz and grid size setting I will just play with the grid size setting until i "get a combo that works"
     
  41. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,411
    ok sounds like a bug, if you can email the details, ill have a look.
     
    tree_arb likes this.
  42. tree_arb

    tree_arb

    Joined:
    Dec 30, 2019
    Posts:
    323
    thanks I got the box collisions working in v3 with your file :) The graphics update to the point colors is horrendously slow as you know. However sampling of the points is running just fine. So I can use this to sample the colors/locations and act accordingly. It happens to be that I dont need to alter the source point cloud right now, but only need to extract the position and color data. Cant thank you enough!
     
  43. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,411
    New release for the standalone converter,
    fixed bug where old data was not cleared (unless restarted application between conversions)
    https://github.com/unitycoder/PointCloudConverter/releases/tag/29

    also,
    testing new color packing ideas, if this works (combined with new XYZ packing tests),
    could be ~66% savings compared to current packed format.
    (although this is more aggressively packing positional data, around 0.03mm max precision)
    upload_2022-11-27_13-51-35.png
     
    TokyoWarfareProject and tree_arb like this.
  44. tree_arb

    tree_arb

    Joined:
    Dec 30, 2019
    Posts:
    323
    Is it memory that the color packing saves? Or storage size?
     
  45. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,411
    helps in storage (converted file size), tile loading speed and memory also,
    actually after testing, its currently only ~33% savings..

    once it works properly, ill test some heavy scene for drawing performance.
     
    tree_arb likes this.
  46. tree_arb

    tree_arb

    Joined:
    Dec 30, 2019
    Posts:
    323
    I am using the new converter and everything is working well. When I convert a folder of laz files and read from root file:

    PointCloudViewerTilesDX11, public Vector3 GetOffset()

    I get the same value as cloud compare, which is great, however it makes no difference if I converted with "auto offset" or not. The render location and GetOffset() value are always the same as the original file.

    Is auto offset supposed to shift the entire point cloud to (0,0,0)?

    I know you mentioned adding a movable container to the v3 would be difficult as it requires bigger refresh values, but what about positioning it once at the start? Am I understanding correct that this is what the auto offset is doing?

    I'm still struggling to position the clouds exactly where they need to go inside map sdks, as I instead need to position the map around the cloud because of no ability to put a start location on the cloud points



     
  47. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,411
    That one returns the original offset, so when auto-offset was used in converter,
    you can still retrieve the original position info. (or how much the cloud was moved).

    ok i see, if cloud was not moved, it should really be 0,0,0 then, converter seems to be missing that.

    It takes first point from the cloud,
    uses that value as -offset (so the whole cloud then moves nearer to 0,0,0)
    *although if first point is totally stray away point, then it wont work.

    that would be easier, i'll test it and let you know.
     
    tree_arb likes this.
  48. tree_arb

    tree_arb

    Joined:
    Dec 30, 2019
    Posts:
    323
    That header offset value represents real word coordinates so those numbers do need to be preserved as you mention,

    I'm not sure I understand exactly, if the cloud was not moved the header should be 0,0,0?

    What I'm finding is that whether I use the auto offset or not, the location of the cloud, and the header offset are all the same, rendering does not move...and appears far away so it is rendering off the large offset number i believe, but offset or not those original values do need to remain accessible for map placement
     
  49. tree_arb

    tree_arb

    Joined:
    Dec 30, 2019
    Posts:
    323
    ok i see the auto offset on/off is now working in the new release :)
     
  50. tree_arb

    tree_arb

    Joined:
    Dec 30, 2019
    Posts:
    323
    hello again,
    How can I make a second camera ignore rendering of the v3 point clouds?
    Camera culling mask doesn't work because of the nature of the point cloud shader rendering.

    The v3 Tile viewer has the public bool "Render only main cam" however this does not work. if true, I get null error message here

    PointCloudViwerTilesDX11.cs
    line 1043

    Code (CSharp):
    1.     public void OnRenderObject()
    2.         {
    3.             print (Camera.current.tag);
    4.             if (rootLoaded == false || (renderOnlyMainCam == true && Camera.current.CompareTag("MainCamera") == false)) return;
    5.      
    6.        
    When i print (debug) the Camera.current I get scene camera and a null reference

    so it seems it does not access the game window rendering camera properly