-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Below is a detailed, end-to-end walk-through, reconstructing a 3D model from original point clouds and importing the model to Unity for VR rendering. It consists of four steps.
1. Reconstruct Mesh from Point Cloud
3. Prepare for use in Unity using Blender
-
Open MeshLab
-
Goto
File -> Import Mesh...
and select your input point cloud file -
Goto
Filters -> Point Set -> Compute normals for point sets
. This is required for Screened Poisson Reconstruction -
Goto
Filters -> Remeshing, Simplification and Reconstruction -> Screened Poisson Surface Reconstruction
-
You can adjust Reconstruction Depth to obtain meshes of different resolution (triangle count). The deeper the reconstruction depth is, the higher the resolution.
-
We used Depth = 8 for low resolution and Depth = 10 for high resolution
-
-
In project window (by default is on top right of the window), select Poisson mesh, goto
File -> Export Mesh As...
to save the reconstructed mesh- in Choose saving options window, check Color, Normal for Vert , and uncheck Binary encoding for Additional parameters
-
Open Metashape.
-
Goto
File -> Import -> Import Points...
and select your input point cloud file -
Goto
Model -> Transform Region -> Reset Region
and select yes -
Goto
Workflow -> Build Mesh...
, in Quality select/enter desired Face count and click OK -
Goto
File -> Export -> Export Model...
, uncheck Binary Encoding and click OK
Option 1: Color transfer from high resolution mesh using Blender (Open Source. Last updated for v2.79b, using defualt layout)
-
Open Blender
-
Press Esc to dismiss the launch screen and press Delete (macOS: fn + delete) to remove the default cube
-
Use
File -> Import -> Stanford (.ply)
to import both high and low resolution meshes. Note: files can only be opened one by one -
Select (on top right of the window) the low resolution mesh

- Click Object Mode (on buttom left of the view) and switch to Edit Mode

- Select Shading/UVs (on the left side of the view), under UV Mapping, select Smart UV Project and click OK

-
Open a new image view
- Goto the top right corner of the 3D view and drag left to create a new area
- On buttom left of the new view, click Object Mode and switch to UV/Image Editor
-
On the bottm of the image view, click New and set the Width and Height to 8192px
-
Select the high resolution mesh, then, while holding shift, select the low resolution mesh
-
While in Edit Mode, goto Properties Editor (buttom right of the window), select Render (camera icon), and find Bake.
-
Change Bake Mode to Vertex Color.
-
Check Selected to Active.
-
Hit Bake
- After baking is done, at bottom of image view, goto
Image -> Save As Image
-
-
Select low resolution mesh and goto
File -> Export -> Stanford (.ply)
. In Export PLY, check UVs, then click Export PLY to save the low resolution mesh with its UVs.
0: Prepare low resolution mesh with UV using Blender (Open Source. Last updated for v2.79b, using defualt layout)
-
Open Blender
-
Press Esc to dismiss the launch screen and press Delete (macOS: fn + delete) to remove the default cube
-
Use
File -> Import -> Stanford (.ply)
to import the low resolution mesh -
Click Object Mode (on buttom left of the view) and switch to Edit Mode

- Select Shading/UVs (on the left side of the view), under UV Mapping, select Smart UV Project and click OK

- Goto
File -> Export -> Stanford (.ply)
. In Export PLY, check UVs, then click Export PLY to save the low resolution mesh with its UVs.
-
ccmake .
-
Terminal will now display an empty cache page to modify settings
-
Press c to configure, and after auto configuration, check if the following are set. You can press enter to modify an option, and press enter again to save an option
- CGAL_DIR: the path to CGAL (e.g. /usr/local/lib/cmake/CGAL).
- Boost_INCLUDE_DIR: the path to boost library (e.g. /usr/local/include)
-
If no errors or warnings are emitted, continue to press c to confingure until the option for press g to generate is available
-
Press g to generate
-
CCMake will exit. Continue to compilation.
-
cmake .
-
If no errors or warnings are emitted, continue to compilation
make
Note: You can cleanup the compile files by make cleanup
./pointsTransfer <input-point-cloud> <input-triangular-mesh>
The output would be texture.png
under src
3. Prepare for use in Unity using Blender (Open Source. Last updated for v2.79b, using defualt layout)
-
Open Blender
-
Press Esc to dismiss the launch screen and press Delete (macOS: fn + delete) to remove the default cube
-
Use
File -> Import -> Stanford (.ply)
to import the low resolution mesh with UVs. -
Select Tools (on the left side of the view), under Edit, click on Set Origin and select Geometry to Origin so the object is easier to find in Unity

-
Optional: some meshes may require normal flipping to be rendered properly in Unity.
-
For example, most meshes have normals pointing outwards and will not be visible if the camera is placed inside the mesh
-
Click Object Mode (on buttom left of the view) and switch to Edit Mode
- Select Shading/UVs (on the left side of the view), under Shading, Normals:, click Flip Direction
-
-
Goto
File -> Export -> Wavefront (.obj)
. In Export OBJ, check Include UVs and uncheck Write Materials, then click Export OBJ to save the low resolution mesh with its UVs.
-
Open Unity
-
Create new project/open exisiting project
-
Open project folder. You can right click in project view and click Reveal in Finder/Show in Explorer.

-
Copy the mesh (.obj) and texture file into
Assets
folder. -
Go back to Unity and wait for Unity to finish importing the asset.
-
Select the mesh in project explorer and in insepctor, goto Materials tab, switch to Use External Materials (Legacy) for Location. Click Apply.

-
After Unity finishes reimporting the mesh, you will find a new Materials folder which contains a new defaultMat material
-
Select the material, click the circle next to Albedo under Main Maps and select your texture file.

- Drag and drop the mesh into hierarchy to add the mesh to the scene.

- Done.
