Single Sided Meshing Of A Terrain Scan

Overview

  • In the following tutorial, we will create a single sided mesh from a terrain scan.
  • We will use a .LAZ file containing the aerial scan of the Serpent Mound park in Ohio, downloaded from http://www.liblas.org/samples/

Caching The LAZ File As SPRT

[G] Create a Point Loader CreatePL

[G] Pick the downloaded .LAZ file.

  • The Point Loader will look for a matching SPRT file, and if it does not find one, it will report a MISSING CACHE FILE in the Status field on red background:
../../_images/SQ_SerpentMound_LAZ_missing_cache.png
  • The .LAZ file contains metadata describing the available channels.
  • We can preview some of that data directly from the .LAZ file.
  • For example, an Intensity channel is available and is displayed by default, however it is in a different scale, so it appears black.

[G] Change the Scale Channel value to 100.0 - this will multiply the Intensity and it will show up in the Viewport as a more useful grayscale value:

../../_images/SQ_SerpentMound_LAZ_intensity100.png
  • The .LAZ file needs to be cached to .SPRT file

[G] Pressing the Build SPRT Cache button [1].

  • Since the .LAZ file does not contain any information about units, we will have to provide this information.

[G] This particular file happens to be in Meters [2], so just confirm the suggestion by pressing OK [3]:

../../_images/SQ_SerpentMound_LAZ_units.png
  • The conversion will now be scheduled in the Task Manager.
../../_images/SQ_SerpentMound_LAZ_converting.png
  • After a few seconds, the SPRT cache will be ready and will be loaded automatically.
  • The Status field will turn green and show CACHE UP TO DATE.
../../_images/SQ_SerpentMound_LAZ_uptodate_cache.png

Generating Normals

  • Now that we have the SPRT cache, let’s look into generating Normals.

[R] Note: The Point Normals Generation operator is not considered production-ready for general cases, but it tends to work well in the special case of terrain data where most normals point mainly up.

[G] To add a Point Normals Generation operator, right-click the Point Loader and select from the Operators list:

../../_images/SQ_SerpentMound_LAZ_add_normal_generation.png
  • The default Radius of 5.0 is a bit large for this data set.

[G] Reduce the Radius value to 3.0 to speed things up:

../../_images/SQ_SerpentMound_LAZ_normal_generation_op.png

[B] The original data set it located very far away from the World Origin, and some operations and display features become less precise at large offsets.

  • In addition to generating Normals, let’s also move the point cloud to the World Origin.

[G] Right-click the selected object and use the right-most menu to select Sit At World Origin”:

../../_images/SQ_SerpentMound_LAZ_sit_at_origin.png
  • Let’s resize the Home Grid to get a better idea of the size of the Serpent Mound park.

[G] Enter 100.0 for the Home Grid Spacing

  • With the default 10 subdivisions, we get a 2000 Meters long grid along each axis (from -1000m to 1000m).
../../_images/SQ_SerpentMound_LAZ_grid_100x10.png
  • We do not want to display the resulting Normals in the viewport, but we want to cache a new SPRT with the generated Normal channel already included.

[G] Use the Export rollout’s Export In World Space button to bake both the translation to the World Origin and the new Normal channel to a new SPRT file with the suffix “Origin”.

../../_images/SQ_SerpentMound_LAZ_save_origin_file.png

[G] Once the saving has finished, delete the original Point Loader.

[G] Create a new Point Loader and select the Origin SPRT file to read.

[G] Be sure to scale the Intensity channel by 100.0 again.

../../_images/SQ_SerpentMound_LAZ_load_origin_file.png
  • The file now contains valid Normals, so the points can participate in dynamic lighting.

[G] Enable the Lighting in the Display rollout of the Point Loader.

[G] By default, the Lighting of Points is disabled in the Viewports - check the Toggle Light Of Points... icon to enable:

../../_images/SQ_SerpentMound_LAZ_use_lighting.png

[G] Instead of displaying the Intensity * Scale 100, switch to [User Color] value and set the Color Scale to 1.0 by right-clicking the slider and picking the DEFAULT value:

../../_images/SQ_SerpentMound_LAZ_use_lighting_user_color.png
  • As you can see, the points are shaded based on their new Normals!

Double-Sided Meshing

[G] With the Point Loader still selected, create a new Mesher object by clicking on the 3rd icon from the left.

  • The Mesher will be connected to the Point Loader automatically.
  • It will suggest a possible Radius value based on the distance of the points in the cloud.
../../_images/SQ_SerpentMound_LAZ_create_mesher.png

[G] Accept the Suggested Radius by pressing the Set Radius to ... button [1].

[G] Then press Update Mesh [2] to build the mesh:

../../_images/SQ_SerpentMound_LAZ_meshing_suggested_radius.png
  • The Mesher shows the Color channel by default, but the Point Loader did not have a Color channel, so the resulting Vertex Color channel is black.

[G] Switch to [User Color] to show the mesh in White (or any other color):

../../_images/SQ_SerpentMound_LAZ_meshed_suggested_radius_white.png
  • The Suggested Radius appears to be a bit too large (due to the nature of the data set which has quite a variable spacing).

[G] Let’s halve it to about 2.0 units and press Update Mesh again:

../../_images/SQ_SerpentMound_LAZ_meshed_radius_2_white.png
  • This looks much better - the ancient Serpent shape can be recognized clearly on the terrain (green arrow).

[G] Set a Bookmark to preserve the current view by clicking the New Bookmark icon in the Bookmarks panel.

[G] Orbit the view to look at the underside of the mesh, and set another Bookmark to keep that view, too.

../../_images/SQ_SerpentMound_LAZ_meshed_radius_2_underside.png
  • The bottom looks pretty much the same as the top.
  • In some cases, we want to remove this underside to reduce the number of polygons.

Culling Faces By Normal Similarity

[B] When the Mesher finds a Normal channel in the Point Loader, it samples it into a channel called Mapping2.

[G] Once such a mesh is created, the Cull By Normal option [1] can be enabled.

  • This will enable a Cull Faces By Normal Similarity operator on the Mesher.
  • It will compare the data in Mapping2 with the actual Normals generated by the Mesher, and will remove the back-facing polygons.
  • Tweaking the value can remove more or less polygons depending on the angle between the two Normal vectors.

[B] What would happen if the Point Loader did not contain a file with valid Normals?

In that case, an error would be displayed in the Task Manager, explainign that the Cull Faces By Normal Similarity requires a valid Normal channel in the point data.

[G] Press the Update Mesh button [2] to remove the back faces - it should take just about a second to remove half the faces.

[G] Disable the Points display in the Viewport [3] - we are only inrerested in the mesh now...

../../_images/SQ_SerpentMound_LAZ_meshed_radius_2_underside_cbns.png
  • As you can see above, the underside polygons are now gone because the Display defaults to backface culling.

[G] To visualize the two sides of the same polygons, switch the Display of the Mesher to “Tint Back”, and set the tint color to a shade of red.

  • The result is that the front of the polygons will be shaded in white, and the backside will be shaded in red:
../../_images/SQ_SerpentMound_LAZ_meshed_radius_2_underside_tintback.png

Conforming The Mesh To The Point Cloud

  • At this point, the one side of the mesh still passes approximately 2 meters above the actual point cloud surface.

[G] Check the Flatten option of the Mesher which enables a “Conform To Points” operator on the Mesher.

../../_images/SQ_SerpentMound_LAZ_conform.png
  • As result, the single-sided mesh will be pushed down to the point cloud:

[G] Enable the Point Display again to see that the Points and the Mesh surface are coincident now:

../../_images/SQ_SerpentMound_LAZ_facecount.png