PotreeConverter icon indicating copy to clipboard operation
PotreeConverter copied to clipboard

New single-file Potree format

Open m-schuetz opened this issue 11 months ago • 1 comments

About

  • Next version of Potree will have a new single-file format with *.potree ending.
  • It uses color-filtered voxels for lower LODs, and original point cloud data for the highest LOD.
  • The voxel geometry is hierarchically compressed to about 2 bit per voxel. The filtered colors are compressed via a BC-ish compression. Voxels will take about 10 bit per voxel.
  • Points will be compressed with Brotli, which usually gets it down to ~30%.

Overview

The format comprises four main sections

  • first 4 bytes: uint32 byte size of metadata
  • Metadata as JSON string
  • A hierarchy buffer
  • Geometry buffers

Metadata

Metadata contains descriptions of point attributes, byte offsets to the hierarchy and geometry blocks, bounding box, and several other infos about the point cloud.

Example metadata JSON
{
	"version": "2.0",
	"name": "2024.01",
	"description": "",
	"points": 1417800187,
	"projection": "",
	"hierarchy": {
		"firstChunkSize": 168682,
		"stepSize": 6,
		"depth": 10
	},
	"offset": [ 2545704.252, 1210377.936, 872.639],
	"scale": [0.001, 0.001, 0.001],
	"spacing": 26.396867187500903,
	"boundingBox": {
		"min": [ 2545704.252, 1210377.936, 872.639],
		"max": [ 2549083.051, 1213756.735, 4251.438000000116]
	},
	"encoding": "DEFAULT",
	"pointBuffer": {
		"offset": 102400,
		"size": 32761429277
	},
	"hierarchyBuffer": {
		"offset": 32761531677,
		"size": 168682
	},
	"attributes": [
		{
			"name": "position",
			"description": "",
			"size": 12,
			"numElements": 3,
			"elementSize": 4,
			"type": "int32",
			"min": [2545704.252,1210377.936,872.639],
			"max": [2548500.008,1213756.735,1566.392],
			"scale": [1,1,1],
			"offset": [0,0,0]
		},{
			"name": "intensity",
			"description": "",
			"size": 2,
			"numElements": 1,
			"elementSize": 2,
			"type": "uint16",
			"min": [0],
			"max": [65535],
			"scale": [1],
			"offset": [0]
		},{
			"name": "rgb",
			"description": "",
			"size": 6,
			"numElements": 3,
			"elementSize": 2,
			"type": "uint16",
			"min": [0,0,0],
			"max": [65535,65535,65535],
			"scale": [1,1,1],
			"offset": [0,0,0]
		}
	]
}

Hierarchy

Geometry

  • Inner nodes will contain voxel data, leaf nodes will contain point data
  • Voxel positions are encoded relative to the voxels in the parent node (~2bit per voxel)
  • Voxel colors are encoded BC-ish (8 bit per voxel)
  • All children of a node are stored in contiguous memory, allowing us to load all of them in one fetch.
  • Voxel data is stored in a way that allows us to load the most important attributes of multiple nodes in a single fetch. We first store position and filtered colors of all child nodes in contiguous memory, followed by all the remaining attributes. If we are not using the remaining attributes, we do not have to fetch them. [pos] is an array of all positions, and [color] an array of all colors. image

TODOs

  • [ ] Add lots of padding to the metadata section, so that metadata can be altered afterwards without rewriting the entire file.
    • [ ] E.g. capacity for 128kb json? 128kb do not matter much with files that are expected to be GBs large.
    • [ ] Users will need command line tools that can extract the json from a *.potree file, allowing them to modify it in a text editor; and a tool that replaces the metadata of a potree file with a provided json file.

m-schuetz avatar Feb 27 '24 11:02 m-schuetz

@m-schuetz is this maybe obsolete thanks to COPC support added in potree? https://github.com/potree/potree/pull/1381

Rdataflow avatar Jun 18 '24 06:06 Rdataflow