# PotreePlugin

class in `3d-tiles-renderer/three/plugins`

```js
import { PotreePlugin } from '3d-tiles-renderer/three/plugins';
```

Plugin that adds support for Potree point cloud datasets (v1.x and v2.0).

Builds a synthetic additive-refinement tileset and streams point cloud nodes on demand. Each
point is sized by the deepest active node at its position, resolved in the vertex shader
against a texture encoding the active node hierarchy.

Extends PointCloudEffectsPlugin, so the point shape, size clamping, eye dome lighting and
debug color options are available here too.

Example: Streaming a Potree point cloud

```js
import { TilesRenderer } from '3d-tiles-renderer/three';
import { PotreePlugin } from '3d-tiles-renderer/three/plugins';

// scene, camera and renderer are initialized here

const URL = 'https://raw.githubusercontent.com/potree/potree/refs/heads/develop/pointclouds/lion_takanawa/cloud.js';
const tiles = new TilesRenderer();
tiles.registerPlugin( new PotreePlugin( {
	url: URL,
	pointShape: 'sphere',
	edlStrength: 0.4,
	edlRadius: 1.4,
} ) );
tiles.setCamera( camera );
tiles.setResolutionFromRenderer( camera, renderer );
tiles.group.rotation.x = - Math.PI / 2;
tiles.group.position.set( - 0.85, - 4.87, - 0.65 );
scene.add( tiles.group );
camera.position.set( 4, 2, 7 );

renderer.setAnimationLoop( () => {

	camera.updateMatrixWorld();
	tiles.update();
	renderer.render( scene, camera );

} );
```

## Constructor

```js
new PotreePlugin( options?: Object )
```

- `options`, `Object`, optional: PointCloudEffectsPlugin options plus the ones below.
  - `url`, `string | null`, optional, default `null`: Url of the dataset metadata file, `cloud.js` for v1 or `metadata.json` for v2. Falls back to `tiles.rootURL`.
  - `pointScale`, `number`, optional, default `1`: Multiplier on the point size. Can be adjusted after construction.
  - `useRecommendedSettings`, `boolean`, optional, default `true`: Whether to set the renderer error target to a value suited to point spacing based geometric error.
