Configure Potree, a WebGL based viewer for large point clouds, on VMware Photon OS - dcasota/photonos-scripts GitHub Wiki

AR/VR/XR solutions have evolved over the past years. Most devices today make use of LiDAR scanning tecniques to process massive point clouds. Potree is a WebGL based viewer for large point clouds (github.com/potree). It consists of superior algorithms to import&convert and to visualize massive laser cloud data.

Here's a short description on how-to install Potree on VMware Photon OS and in a docker container running on Photon.

To install Photon, see https://github.com/vmware/photon/wiki/Downloading-Photon-OS. If interested to run Photon on Azure, see https://github.com/dcasota/photonos-scripts#readme.

Potree in a docker

On your VMware Photon OS, create a Dockerfile and copy&paste the following content.

FROM ubuntu:21.04
# Use Ubuntu 21.04 because it better fits cmake gcc g++ prerequisites

# Environment variables
ENV INSTALL_ROOT=/potree
ENV LASTOOLS_ROOT=${INSTALL_ROOT}/LAStools
ENV POTREE_CONVERTER_ROOT=${INSTALL_ROOT}/PotreeConverter
ENV POTREE_ROOT=${INSTALL_ROOT}/Potree

RUN mkdir -p ${INSTALL_ROOT} \
         && mkdir -p ${LASTOOLS_ROOT} \
         && mkdir -p ${POTREE_CONVERTER_ROOT} \
         && mkdir -p ${POTREE_ROOT}

# An npm issue workaround on Ubuntu 18.04 - 21.04
# Avoid tzdata error https://stackoverflow.com/questions/67452096/docker-build-hangs-based-on-order-of-install
ARG DEBIAN_FRONTEND=noninteractive
RUN set -ex && \
    apt-get update && \
    apt-get install -y \
    git \
    cmake \
    npm \
    nodejs

RUN apt-get install -y \
    build-essential \
    ca-certificates \
    libtbb-dev \
    libplib-dev

WORKDIR ${INSTALL_ROOT}
# Build LAStools (for needed LAZ capability)
RUN git clone https://github.com/m-schuetz/LAStools.git \
    && mkdir -p ${LASTOOLS_ROOT}/LASzip/build && cd ${LASTOOLS_ROOT}/LASzip/build \
    && cmake -DCMAKE_BUILD_TYPE=Release .. \
    && make

WORKDIR ${INSTALL_ROOT}
RUN git clone -b master https://github.com/potree/PotreeConverter.git \
    && mkdir -p ${POTREE_CONVERTER_ROOT}/build && cd ${POTREE_CONVERTER_ROOT}/build \
    && cmake -DCMAKE_BUILD_TYPE=Release -DLASZIP_INCLUDE_DIRS=${LASTOOLS_ROOT}/LASzip/dll -DLASZIP_LIBRARY=${LASTOOLS_ROOT}/LASzip/build/src/liblaszip.so .. \
    && make

WORKDIR ${INSTALL_ROOT}
# Build Potree from branch develop
RUN git clone -b develop https://github.com/potree/Potree.git \
         && cd ${POTREE_ROOT} \
         && npm install && npm install -g gulp \
         && cp gulpfile.js gulpfile.js.0 \
         && sed 's/port: 1234,/&\nhost: "0.0.0.0",/' gulpfile.js.0 > gulpfile.js \
         && cp gulpfile.js gulpfile.js.0 \
         && sed 's/port: 1234,/port: 443,/' gulpfile.js.0 > gulpfile.js \
         && cp gulpfile.js gulpfile.js.0 \
         && sed 's/https: false,/https: true,/' gulpfile.js.0 > gulpfile.js

EXPOSE 443

WORKDIR ${POTREE_ROOT}
CMD ["gulp","watch"]

To prepare the docker environment, run these commands.

docker system prune --force

iptables -A INPUT -p tcp -m tcp --sport 443 -j ACCEPT
iptables -A OUTPUT -p tcp -m tcp --dport 443 -j ACCEPT
iptables-save >/etc/systemd/scripts/ip4save
docker run -p 443:443 -it $(docker build -q .)

Now start on your client the webbrowser and go to https://{ipaddress}/examples/page.html.

Potree on VMware Photon OS

To directly install Potree on VMware Photon OS, put the following commands in a bash script and run it.

# Environment variables
INSTALL_ROOT=/potree
LASTOOLS_ROOT=${INSTALL_ROOT}/LAStools
POTREE_CONVERTER_ROOT=${INSTALL_ROOT}/PotreeConverter
POTREE_ROOT=${INSTALL_ROOT}/Potree

tdnf install git cmake nodejs ca-certificates gcc make binutils build-essential -y

mkdir -p ${INSTALL_ROOT}
mkdir -p ${LASTOOLS_ROOT}
mkdir -p ${POTREE_CONVERTER_ROOT}
mkdir -p ${POTREE_ROOT}

# >8GB RAM required to compile tbb, hence create an additional 4GB swapfile
dd if=/dev/zero of=/swapfile bs=1024 count=4194304
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile

cd ${INSTALL_ROOT}
git clone https://github.com/m-schuetz/LAStools.git
mkdir -p ${LASTOOLS_ROOT}/LASzip/build && cd ${LASTOOLS_ROOT}/LASzip/build
cmake -DCMAKE_BUILD_TYPE=Release ..
make

cd ${INSTALL_ROOT}
git clone https://github.com/wjakob/tbb.git
cd tbb/build
cmake ..
make -j
make install

cd ${INSTALL_ROOT}
git clone -b master https://github.com/potree/PotreeConverter.git
mkdir -p ${POTREE_CONVERTER_ROOT}/build && cd ${POTREE_CONVERTER_ROOT}/build
cmake -DCMAKE_BUILD_TYPE=Release -DLASZIP_INCLUDE_DIRS=${LASTOOLS_ROOT}/LASzip/dll -DLASZIP_LIBRARY=${LASTOOLS_ROOT}/LASzip/build/src/liblaszip.so ..
make

cd ${INSTALL_ROOT}
git clone -b develop https://github.com/potree/Potree.git
cd ${POTREE_ROOT}
npm install && npm audit fix && npm install -g gulp
cp gulpfile.js gulpfile.js.0
sed 's/port: 1234,/&\n                host: "0.0.0.0",/' gulpfile.js.0 > gulpfile.js
cp gulpfile.js gulpfile.js.0
sed 's/port: 1234,/port: 443,/' gulpfile.js.0 > gulpfile.js
cp gulpfile.js gulpfile.js.0
sed 's/https: false,/https: true,/' gulpfile.js.0 > gulpfile.js

iptables -A INPUT -i eth0 -p tcp --dport 443 -j ACCEPT
iptables-save >/etc/systemd/scripts/ip4save

gulp watch

Now start on your client the webbrowser and go to https://{ipaddress}/examples/page.html.

Findings

The WebGL technology still has a lot of culprits. Not every point cloud works smoothly on webbrowser Google Chrome, Microsoft Edge, Firefox, etc. In addition the client hardware has impact, too. The Potree github user forum (see for instance https://github.com/potree/potree/issues/1090) helps to answer user and developer questions.