Importing Point Clouds
Importing Point Cloud is really easy with INTERACT: INTERACT/Import/Point Cloud
Supported Point Cloud files formats are:
- E57 (.e57)
- PTS / PTX (.pts, .ptx)
- LAS (.las)
Our method encodes the point cloud file to a database (.db) file on the computer (in Assets/3DPointClouds). In Unity, the OctoPCLTreeServer component then streams dynamically the most relevant points according to the player’s position and the point budget.
The creation of the database file can take up to several hours.
Re-use of data
Once you have converted your point cloud, you can re-use the database in another project or scene.
For this, you just have to right-click on your hierarchy windows, and follows the following path:
Then, select the database you want to use.
Visualize Point clouds
Octopcl Appearance
- Point cloud appearance: 3 different visualization modes are available. (points rendered as points, splat or cones).
- Color: RGB or Gradient height visualizer.
- Post process: None or EDL (Eye Dome Lighting).
Octopcl Tree Server
- Point budget: maximum number of points that are to displayed per frame. If you encounter frame rate issues, point budget should be decreased.
- Point budget Mem: number of persistent points loaded in RAM (Point budget Mem should be slightly greater that Point budget). It adjusts the cache size that allows preloading points in the vicinity of the field of view (avoid points popping up in the scene).
- Min Projected Size: minimum projected pixel-size of chunks in screen space.
- Downstream chunk: number of chunks loaded per frame. Beware of GPU crashes if set too high.
- Center Origin: if your point cloud is not visible, it is probably that its origin is too far away. This button will recenter it.
Sample data
You can find sample pointcloud here: http://www.libe57.org/data.html
Editing Point Clouds
INTERACT provides a set of basic tools for manually editing and rendering 3D points clouds.
- Cropping and removing points: Instantiates a sizable box providing cropping and removing features. Select one cloud by dragging it into the ‘point cloud’ field in the inspector of PointCloudTool.
- Crop: will create a new point cloud (subset of the original one) with the points contained inside the box.
- Remove: will remove the points inside the box from the original point cloud.
Point cloud Clash Detection
In order to validate if a piece of equipment can fit in an existing building, point cloud clash detection might be a handy feature. It will allow you to highlight any clashes - i.e. two objects that are interfering - between point cloud and 3D meshes.
PointCloudMeshCollider
You need to add a "Octopcl Collision Scene" component to your point cloud. Which means it can now detect when a collision happens.
-
Resolution: Resolution is in meters, and will indicate the precision of clash computation. This can be quite memory intensive, so be careful not to overload computer's memory by setting this setting too low. This resolution will be applied for the whole scene, so it might be adjusted for point cloud that cover a large span area.
-
Minimum point intersected: before triggering a collision event. When your point cloud is noisy, triggering a collision event every time a point is intersected might be too sensitive. You can set this value to act as a threshold.
Next add a Octopcl Mesh Collider
component to the meshes we want to test collisions against.
Ensure the GameObject has a Mesh Collider
component attached to it.
When the mesh intersects with another point cloud during play mode the "Intersects" field of the OctopclMeshCollider
component will be set to true
.
Callbacks
OctopclMeshCollider
allows you to get notified when the mesh collides with a point cloud allowing you to trigger events when this happens.
IntersectTriggerOn
Called when the mesh starts colliding with a point cloud.
IntersectTriggerOff
Called when the mesh stops colliding with a point cloud.
Usage Example
Attach this script to the OctopclMeshCollider
you want to detect clashes with.
It will print a log in the console and change the renderer color to red when a clash is detected.
using UnityEngine;
using xde.unity;
[RequireComponent(typeof(OctopclMeshCollider))]
public class MyCollisionHandler : MonoBehaviour
{
private OctopclMeshCollider meshCollider;
private Renderer m_renderer;
private void OnEnable()
{
meshCollider = GetComponent<OctopclMeshCollider>();
m_renderer = GetComponent<Renderer>();
meshCollider.IntersectTriggerOn += TriggerOn;
meshCollider.IntersectTriggerOff += TriggerOff;
}
private void OnDisable()
{
meshCollider.IntersectTriggerOn -= TriggerOn;
meshCollider.IntersectTriggerOff -= TriggerOff;
}
private void TriggerOn()
{
Debug.Log("Start intersecting with point cloud.");
m_renderer.material.color = Color.red;
}
private void TriggerOff()
{
Debug.Log("Stop intersecting with point cloud.");
m_renderer.material.color = Color.yellow;
}
}
Point cloud to Mesh distance
To compute the distance between a point cloud and a mesh object use the OctopclCloud2MeshDistance component. Fill the point cloud and mesh root fields with the corresponding game objects.
After computing distance you can visualize it by selecting the Field Distance in Octopcl Fields component.