• "Mwoah" - Kimi Räikkönen
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Dear Guest. Follow RaceDepartment on Twitter, Facebook, Instagram, Twitch, Steam and YouTube.

Tracks LIDAR (Point cloud) to mesh tutorial

Discussion in 'Assetto Corsa Modding Discussions' started by DanTDBV, Jan 31, 2017.

  1. DanTDBV

    DanTDBV

    Messages:
    86
    Ratings:
    +78
    I have decided to repost this updated version, as the original is lingering in archive limbo

    This is to keep others from having as bumpy, a ride into this as i have had. Many frustrations.

    Finding the right way into LIDAR point clouds, is like navigating a dense jungle.

    There are so many purposes and ways to use LIDAR data, that we have acces to a forest full of free and paid for software, plus lots of file formats. Ad to that, all the things you can do to those files.

    Created with CloudCompare 2.6.2 and Blender 2.76b

    A heartfelt thankyou to Daniel Girardeau-Montaut, the creator of Cloudcompare. For creating the software and the pointers, that made this tutorial better.

    What is LIDAR?
    Lidar
    (also written LIDAR, LiDAR or LADAR) is a remote sensing technology that measures distance by illuminating a target with a laser and analyzing the reflected light. Although thought by some to be an acronym of Light Detection And Ranging, the term lidar was actually created as a portmanteau of "light" and "radar". Lidar is popularly used as a technology to make high-resolution maps, with applications in geodesy, geomatics,archaeology, geography, geology, geomorphology, seismology, forestry, remote sensing, atmospheric physics, airborne laser swath mapping (ALSM), laser altimetry, and contour mapping. (From Wikipedia).

    Getting LIDAR data.
    This is somewhat beyond the scope off this tutorial, but searching for geodata or height model, together with the country, should be a good starting point.

    Software needed
    CloudCompare
    It is Open Source and can be downloaded here:
    http://www.danielgm.net/cc/

    CloudCompare supports import of 27 different file formats. There is a pretty fair chance, it will eat your file.

    Before we start, a copyright notice needed for the data used.
    Copyright notice Bellahøj Park Point cloud and Ortho photo
    As required, according to this site: (In Danish)
    http://download.kortforsyningen.dk/content/vilk%C3%A5r-og-betingelser
    Contains data from Geodatastyrelsen and Danske kommuner Fot-data
    Ekstracted lokation : Bellahøj Park Copenhagen
    DHM/Point cloud
    DLD 30/10-2015 Punktsky_617_72_LAZ_UTM32-ETRS89
    Ekstracted lokation : Nisseringen Næstved
    DHM/Point cloud
    DLD 14/11-2015 Punktsky_612_68_LAZ_UTM32-ETRS89
    http://download.kortforsyningen.dk/content/geodataprodukter
    DLD = Download date
    DanTDBV D@nN (My photo and film signature)

    My experience's with the exported mesh.
    I have found that Blender, does not like the mesh, that comes out from CloudCompare.

    I am now using MeshMixer to reduce the mesh. Erase & Fill, Reduce and Smooth are the tools I use.
    Retopoflow and the Knive tool, are not working as expected. The creator of Retopoflow, has looked at it and he says, that it is behaving strangely.

    Upon import in Blender, I am now moving the Origin, to somewhere inside the model. It does give a better behavier, but not much. I have decided, that I am capable of lining up parts manually. When using obj, it needs a 90 degree flip on the X axis.

    Conclusion:
    If stl or obj is the right choise, I really don't know, but Retopoflow is behaving a little better with obj.

    Current way I do it.
    Apply Global shift/scale upon import
    Export full area, reduce in MeshMixer, that does not worry about reference/anchor/pivot point. Import in Blender, move origin to model, center it, then cut it to pieces.

    On to what you are here for

    How do you do, you do, you do

    I use LAZ files in this case. LAZ is a compressed LAS file.
    • Open CloudCompare
    • Open the file you wish to use. Select multiple files with Shift and Control
    • Open LAS File Chose Apply all
    • Global shift/scale Yes to All
    • Navigation: Left mousebutton Rotate, Scroll wheel Zoom, Right mouse button Move
    • You always need to select the file/s You want to work with.
      Select each file in turn (In DB Tree chose the filename)
    • Change active Scalar Fields to Classification (This is the one I prefer to use)
    2 fields have been changed here

    [​IMG]

    Merge and select

    I usually do a fast selection, of a wider area than needed and save that, before refining the area further.
    • Control select all files (Same as above)
    [​IMG]

    • Click Merge multiple clouds button in Top ToolBar (TTB)
    [​IMG]
    • Adjust the view, until the desired area is visible
    • Click Segment button in TTB (scissors)
    • (Opens Segment toolbar. Hover mouse over tools for tool tips)
    [​IMG]
    • Select area of cloud to keep. For an irregular area, use Polygonal selection
    • If you are satisfied Hit Confirm segmentation. If you are not hit Clear segmentation. Cancel to quit
      In DB Tree chose the parts, of the cloud you wish to discard. (I clear the checkmarks, from the parts I want to keep) Hit Delete
    • Select resulting file and save a backup. I have good experience with exporting as LAZ. I chose Highest resolution. LAS/LAZ comparison: LAS 287 MB, LAZ 40,6 MB.
    Further area refining.

    [​IMG]
    • Now use the Segment tool, to remove the areas not visible from the track.
    • Polygon selection makes it possible to do complex selections.
    [​IMG]
    After Segment out selection
    [​IMG]

    [​IMG]
    • Save another backup
    To be continued

    I am not allowed to upload more, than 10 pictures so it is split into 2.

    Go and have a break. Do what you do to relax and refresh.
     
    Last edited: Jan 31, 2017
    • Like Like x 3
  2. DanTDBV

    DanTDBV

    Messages:
    86
    Ratings:
    +78
    Continued

    Welcome back. Are you ready?

    Reference/anchor/pivot point.
    Remember all the big numbers in the Global shift/scale dialog?
    The numbers in the big box, is the placement of the reference/anchor/pivot point, in the file you open.
    The numbers in the small box, is the placement of the reference/anchor/pivot point, in the file while you work.

    The Global shift information is discarded, when exporting to .stl, so the reference/anchor/pivot point, coordinates will be the numbers from the little box.

    Abandonned earlier conclusion.
    For landscapes I prefer to have the pivot point, in the center of the model. It makes it easier to cut the model into managable pieces and reassemble them.

    Current way I do it.
    Apply Global shift/scale upon import
    Export full area, reduce in MeshMixer, that does not worry about reference/anchor/pivot point. Import in Blender, move origin to model, center it, then cut it to pieces.

    Moving reference/anchor/pivot point.
    • Select the file
    • Chose Edit
    [​IMG]
    • Chose Edit global shift and scale
    • Change X, Y, Z values to zero. Keep the scale.
    • Hit yes
    • Click Point picking in TTB
    • Click on the point in the cloud, where you want the center to be.
    • Write down X, Y, Z values. Click discard
    • Select the file
    • Chose Edit
    • Chose Apply transformation
    • Go to Axis, Angle pane
    • Enter your written values, in the Translation section. You may need to check Apply inverse transformation.
    • Hit Ok
    Export test mesh
    • Select the file
    • Chose Edit
    • Chose Mesh
    • Chose Delaunay 2.5D (XY plane) (Until now I have left Max egde length at default)
    • Select the file
    • Save as Binary .stl file.
    Open the exported .stl in Blender and check, if it is where you want it.
    When you have it right, do another backup.

    Very important!
    Whenever you reload your centered cloud, do NOT! Shift the global scale!

    Your choise should be:
    • Global shift/scale No
    Chosing the level of the cloud, to convert to mesh
    • Select the file
    • In the DB Tree Properties SF display params window, You can play around with the 2 circles until you only have the ground. (With the files I have, 2 is the ground)
    [​IMG]
    • I find it easier to uncheck, show NaN/out of range values in grey, on the parameters pane.
    • Chose Filter points by value in TTB
    • Change both fields to your SF display params ground value
    • Hit Ok
    • Select Mesh and save. (I usually ad the levels to the name)
    Creating a full resolution Mesh and export(This works for me)
    • Select the file
    • Chose Edit
    • Chose Mesh
    • Chose Delaunay 2.5D (XY plane) (Until now I have left Max egde length at default)
    • Select the file
    • Save as Binary .stl file.
    [​IMG]
    [​IMG]
    Full resolution vs reduced resolution.

    Abandonned earlier conclusion.
    I found that in cleaning a full res mesh in Meshmixer, I was reducing the areas I worked with about 70-90%. It is much easier to reduce the cloud, before creating the mesh.
    This however have the disadvantage, that the terrain details is washed out. (Not as sharp as with the full resolution cloud).
    I have decided to keep the full poly mesh and creating a low poly mesh over that.
    It does however slows down the PC.
    My solution is to cut the full poly mesh, into chunks that I work on seperatly. This is way more easier in than in Blender. At least from what I know. More about this below.

    How I do it now
    I export the full res mesh. Using Meshmixer's Erase & Fill, Reduce and Smooth tools as approriate.

    Creating a reduced resolution Mesh
    • Select the file
    • Chose Edit
    • Chose Subsample
    • Move the slider from small towards large, remember your setting, hit ok
    • You can delete the resulting layer, without touching the base layer.
    • Play around with this until you, are sattisfied with the cloud density.
    • Select the file
    • Chose Mesh
    • Chose Delaunay 2.5D (XY plane) (Until now I have left Max egde length at default)
    • Select the file
    • Save as Binary .stl file.
    [​IMG]

    [​IMG]
    Cutting a mesh into chunks

    Delete everything in CloudCompare. Or as I do, close and reopen CloudCompare. (You did remember to save your progress?)

    Open the .stl file you created above.
    • Select the file
    • Now use the Segment tool, to cut the mesh into managable chunks
    • Keep only the parts you are working with visible
    • If you have cut something, that should not have been, use the merge tool
    • Save each part as you go
    • Always uncheck the parts, you have exported
    When you import the chunks, they are in the right places.
    I have used the resulting files in Meshlab, Meshmixer and Blender.

    I would advise to lock the Location:, Rotation: and Scale: settings in Blender

    You are should now be ready, to continue in your favorite 3D program.

    Some Blender information

    Moving view close to the 3D cursor

    • Hit Alt/Home
    Moving reference/anchor/pivot point in Blender.

    I have kept this as it is usefull for other offcenter models.

    When importing the mesh in Blender, you might find that the placement is off, to way off.
    Chosing Yes to All for Global shift/scale, have seriosly reduced, the placement being off problem.

    The following example, was with No to Global shift/scale.

    This is not happening in Meshlab or Meshmixer, only in Blender.

    One example is the model in the picture. Blenderunits from scene center:
    Transform
    Location
    X=684203.25000
    Y=6123295.5000
    Z=55.56239
    [​IMG]

    There are 6 cars in this picture, can you spot them?

    The reason for this, is the Anchor/Pivot point of the model.
    The Location coordinates tells, where in the world the Anchor/Pivot point is.

    Move the pivot point into the model

    The first step, is to get the 3D cursor, out to the model.
    I had some trouble doing this. The 3D cursor would just not appear, when clicking close to the mesh. With the view back, on the center of the world, the cursor worked as advertised.

    This is how I got it to work:
    • Make sure that the model is selected
    • Chose View Selected
    • Change to Edit mode
    • Hit A to deselect all
    • Select a Vertex
    • Change to Object mode
    Now you should get the 3D cursor, when you click. Well at least I do.
    • Place the 3D cursor, where you want the Pivot point to be.
    • Chose Object/Transform/Origin to 3D Cursor.
    Your model is no longer off the mark.

    A fast way to move the model, is to change the Transform/Location values.
    Transform
    Location
    X:684203.25000
    Y:6123295.5000
    Z:55.56239
    Center of the world
    X:0
    Y:0
    Z:0

    Good luck.

    If you have any questions, then do not hesitate to ask and I will do my best to answer.

    Keep in mind that English, is not my first language.
     
    • Like Like x 2
  3. DanTDBV

    DanTDBV

    Messages:
    86
    Ratings:
    +78
    Updated 31/1-2017. Added abandonned earlier conclusions headlines and a Current way I do it snippet.
     
    • Like Like x 1