Potree在web端显示大型点云模型文件

一、克隆项目代码(准备好上网工具,得先有node.js npm 环境)

复制代码
git clone https://github.com/potree/potree.git

二、依赖安装(换淘宝镜像能快一些)

复制代码
cd potree
npm install

三、运行

复制代码
npm start

四、使用样例

打开浏览器,输入http://localhost:1234/,即可看到 Potree 的界面。

打开任意examples下的html查看模型

五、换成自己的点云模型

将地址中的cloud.js换成自己模型的地址。

复制代码
// Load and add point cloud to scene
		Potree.loadPointCloud("http://5.9.65.151/mschuetz/potree/resources/pointclouds/helimap/360/MLS_drive1/cloud.js", "MLS", e => {
			let scene = viewer.scene;
			let pointcloud = e.pointcloud;
			
			let material = pointcloud.material;
			material.size = 0.5;
			material.minSize = 2.0;
			material.pointSizeType = Potree.PointSizeType.ADAPTIVE;
			material.shape = Potree.PointShape.SQUARE;
			material.activeAttributeName = "rgba";
			
			scene.addPointCloud(pointcloud);

			viewer.scene.view.setView(
				[2652381.103, 1249049.447, 411.636],
				[2652364.407, 1249077.205, 399.696],
			);

			run();
		});

		async function run(){

			proj4.defs("WGS84", "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs");
			proj4.defs("pointcloud", viewer.getProjection());
			let transform = proj4("WGS84", "pointcloud");

			let params = {
				transform: transform
			};

Potree加载的点云格式为OCTree格式的数据结构,无法直接加载格式为LAS,LCD,PLY等格式的点云文件,所以我们需要通过PotreeConverter来将普通的点云格式文件转换为OCtree格式的点云文件。去github下载PotreeConverter对模型文件进行格式转换,只能转换las格式的文件。

复制代码
https://github.com/potree/PotreeConverter
1.7版本可用

win系统下载目录执行如下样例指令

复制代码
PotreeConverter.exe D:\\test.las -o D:\\output

linux系统,可加上版本新版本不好用

复制代码
git clone https://github.com/potree/PotreeConverter.git
cd PotreeConverter
mkdir build && cd build
cmake ..
make

完成以后执行
PotreeConverter /home/yr/test.las -o /home/yr/output
即可得到模型

转换后的文件结构

换成自己的点云后的效果图

相关推荐
喵个咪9 小时前
吃透后台权限系统:从架构设计到 Vue3/React 双框架完整落地
前端·vue.js·react.js
hdsoft_huge9 小时前
全开源数字孪生系统搭建方案:全套技术文档
vue.js·开源·node.js·echarts·webstorm
学且思9 小时前
Vue3 Patch 算法深度解析:从原理到源码实现
前端·vue.js
卤蛋fg610 小时前
vxe-table 导出 XLSX 文件:自动展开分组并导出图片
vue.js
HackTwoHub10 小时前
AI赋能Chrome MCP × JS逆向Skill自动化JS逆向挖洞
javascript·人工智能·chrome·安全·web安全·网络安全·自动化
mengqudoh10 小时前
elementui el-table 表头固定功能
javascript·vue.js·elementui
YiWait10 小时前
基于 Vue 3 的网络收音机,编译为桌面应用软件
前端·javascript·vue.js
古法编程第一人10 小时前
使用Electric同步前后端数据
前端·vue.js
Fisschl10 小时前
在 Vue 中实现输入框@人功能
vue.js
大连好光景10 小时前
登录凭证 | Session+Cookie | Redis Token | JWT
前端·javascript