Potree wrapper for three.js applications
npm install potree-core
npm install and npm run build.
javascript
const scene = new Scene();
const camera = new PerspectiveCamera(60, 1, 0.1, 10000);
const canvas = document.getElementById("canvas");
const renderer = new WebGLRenderer({canvas:canvas});
const geometry = new BoxGeometry(1, 1, 1);
const material = new MeshBasicMaterial({color: 0x00ff00});
const cube = new Mesh(geometry, material);
scene.add(cube);
const controls = new OrbitControls(camera, canvas);
camera.position.z = 10;
const pointClouds = [];
const baseUrl = "data/test/";
const potree = new Potree();
potree.loadPointCloud("cloud.js", url => ${baseUrl}${url},).then(function(pco) {
scene.add(pco);
pointClouds.push(pco);
});
function loop()
{
potree.updatePointClouds(pointClouds, camera, renderer);
controls.update();
renderer.render(scene, camera);
requestAnimationFrame(loop);
};
loop();
`
Custom Request Manager
- The potree core library uses a custom request manager to handle the loading of point cloud data.
- The request manager can be replaced by a custom implementation, for example to use a custom caching system or to handle requests in a different way.
`javascript
class CustomRequestManager implements RequestManager
{
fetch(input: RequestInfo | URL, init?: RequestInit): Promise {
throw new Error("Method not implemented.")
}
async getUrl(url: string): Promise {
return url;
}
}
`
Notes
- Since potree-core is meant to be used as library and not as a full software as potree some features are not available.
- EDL shading is not supported by potree core.
- Removed classification and clipping functionality.
- Removed Arena 4D point cloud support.
- Removed Entwine Point Tile file support.
- GUI elements were removed from the library
- PotreeViewer
- Controls, Input, GUI, Tools
- Anotations, Actions, ProfileRequest
- Potree.startQuery, Potree.endQuery and Potree.resolveQueries
- Potree.timerQueries
- Potree.MOUSE, Potree.CameraMode
- PotreeRenderer, RepRenderer, Potree.Renderer
- JQuery, TWEEN and Proj4 dependencies
Potree Converter
- Use the (Potree Converter)[https://github.com/potree/PotreeConverter/releases] tool to create point cloud data from LAS, ZLAS or BIN point cloud files
- Potree Converter 1.8 creates a multi file structure with each node as an individual file.
- Potree Converter 2.1 creates a single file for all points and separates files for hierarchy index, its faster to create files. Requires a HTTP server configured for file streaming.
- Tool to create hierarquical structure used for point-cloud rendering using potree-core.
- There are two main versions 2.1 witch generates 4 contained files with point data, hierarchy,
- To generate a folder output from a input file run the command .\PotreeConverter '..\input.laz' -o ../output
$3
- The potree converter tool only supports las and laz files, so textural file formats such as .pts, .xyz, have to be first converted into a supported format.
- The TXT2LAS tool from the (LASTools)[https://github.com/LAStools/LAStools] repository can be used for this effect.
- To run the tool use the command .\txt2las64 -i input.pts -ipts -parse xyziRGB -set_scale 0.001 0.001 0.001 -set_version 1.4 -o output.laz`