Skip to content

Commit a852a1f

Browse files
committed
update page_template
1 parent 7c1d95c commit a852a1f

File tree

8 files changed

+16352
-174
lines changed

8 files changed

+16352
-174
lines changed

PotreeConverter/resources/page_template/build/js/potree.js

+76-96
Large diffs are not rendered by default.

PotreeConverter/resources/page_template/build/js/potree.min.js

+6-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

PotreeConverter/resources/page_template/build/shaders/shaders.js

-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ Potree.Shaders["pointcloud.vs"] = [
5252
"uniform float minSize; // minimum pixel size",
5353
"uniform float maxSize; // maximum pixel size",
5454
"uniform float octreeSize;",
55-
"uniform float nodeSize;",
5655
"uniform vec3 bbMin;",
5756
"uniform vec3 bbSize;",
5857
"uniform vec3 uColor;",

PotreeConverter/resources/page_template/build/workers/BinaryDecoderWorker.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

PotreeConverter/resources/page_template/examples/viewer_template.html

+130-69
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@
9191
<script src="../src/FirstPersonControls.js"></script>
9292
<script src="../src/utils/ProfileTool.js"></script>
9393
<script src="../src/utils/MeasuringTool.js"></script>
94+
<script src="../src/utils/TransformationTool.js"></script>
9495
<script src="../src/utils/VolumeTool.js"></script>
9596
<script src="../src/utils.js"></script>
9697
<script src="../src/LRU.js"></script>
@@ -104,6 +105,10 @@
104105

105106
<!-- INCLUDE ADDITIONAL DEPENDENCIES HERE -->
106107
<!-- INCLUDE SETTINGS HERE -->
108+
<!--<script src="../libs/plasio/js/laslaz.js"></script>
109+
<script src="../libs/plasio/vendor/bluebird.js"></script>
110+
<script src="../build/js/laslaz.js"></script>
111+
-->
107112

108113
<!-- INFOS / STATS -->
109114
<div id="lblNumVisibleNodes" class="info" style="position: absolute; left: 10px; top: 80px; width: 400px; color:white"></div>
@@ -138,6 +143,14 @@
138143
if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
139144
sceneProperties.navigation = "Orbit";
140145
}
146+
147+
if(sceneProperties.quality === null){
148+
if(Potree.Features.SHADER_INTERPOLATION.isSupported()){
149+
sceneProperties.quality = "Interpolation";
150+
}else{
151+
sceneProperties.quality = "Squares";
152+
}
153+
}
141154

142155

143156
var fov = sceneProperties.fov;
@@ -195,6 +208,8 @@
195208
};
196209

197210
function setQuality(value){
211+
212+
198213
if(value == "Interpolation" && !Potree.Features.SHADER_INTERPOLATION.isSupported()){
199214
quality = "Squares";
200215
}else if(value == "Splats" && !Potree.Features.SHADER_SPLATS.isSupported()){
@@ -298,18 +313,20 @@
298313
for(var i = 0; i < attributes.attributes.length; i++){
299314
var attribute = attributes.attributes[i];
300315

301-
if(attribute === PointAttribute.COLOR_PACKED){
316+
if(attribute === Potree.PointAttribute.COLOR_PACKED){
302317
options.push("RGB");
303-
}else if(attribute === PointAttribute.INTENSITY){
318+
}else if(attribute === Potree.PointAttribute.INTENSITY){
304319
options.push("Intensity");
305320
options.push("Intensity Gradient");
306-
}else if(attribute === PointAttribute.CLASSIFICATION){
321+
}else if(attribute === Potree.PointAttribute.CLASSIFICATION){
307322
options.push("Classification");
308-
}else if(attribute === PointAttribute.NORMAL_SPHEREMAPPED || attribute === PointAttribute.NORMAL_OCT16){
309-
options.push("Phong");
310-
options.push("Normal");
311323
}
312324
}
325+
if(attributes.hasNormals()){
326+
options.push("Phong");
327+
options.push("Normal");
328+
}
329+
313330
options.push("Height");
314331
options.push("Tree Depth");
315332
}
@@ -440,7 +457,7 @@
440457

441458
// load pointcloud
442459
if(pointcloudPath.indexOf("cloud.js") > 0){
443-
POCLoader.load(pointcloudPath, function(geometry){
460+
Potree.POCLoader.load(pointcloudPath, function(geometry){
444461
pointcloud = new Potree.PointCloudOctree(geometry);
445462

446463
pointcloud.material.pointSizeType = Potree.PointSizeType.ADAPTIVE;
@@ -615,6 +632,8 @@
615632
};
616633

617634
var intensityMax = null;
635+
var heightMin = null;
636+
var heightMax = null;
618637

619638
function update(){
620639
Potree.pointLoadLimit = pointCountTarget * 2 * 1000 * 1000;
@@ -647,10 +666,15 @@
647666
}
648667
}
649668
}
669+
670+
if(!heightMin){
671+
heightMin = bbWorld.min.y;
672+
heightMax = bbWorld.max.y;
673+
}
650674

651675
pointcloud.material.clipMode = clipMode;
652-
pointcloud.material.heightMin = bbWorld.min.y;
653-
pointcloud.material.heightMax = bbWorld.max.y;
676+
pointcloud.material.heightMin = heightMin;
677+
pointcloud.material.heightMax = heightMax;
654678
pointcloud.material.intensityMin = 0;
655679
pointcloud.material.intensityMax = intensityMax;
656680
pointcloud.showBoundingBox = showBoundingBox;
@@ -838,17 +862,11 @@
838862

839863
var bbWorld = Potree.utils.computeTransformedBoundingBox(pointcloud.boundingBox, pointcloud.matrixWorld);
840864

841-
pointcloud.material.size = pointSize;
842865
pointcloud.visiblePointsTarget = pointCountTarget * 1000 * 1000;
866+
pointcloud.material.size = pointSize;
843867
pointcloud.material.opacity = opacity;
844868
pointcloud.material.pointColorType = pointColorType;
845-
846-
//if(pointcloud instanceof Potree.PointCloudOctree){
847-
pointcloud.material.pointSizeType = pointSizeType;
848-
//}else if(pointcloud instanceof Potree.PointCloudArena4D){
849-
// //var pst = pointSizeType === Potree.PointSizeType.ADAPTIVE ? Potree.PointSizeType.ATTENUATED : pointSizeType;
850-
// pointcloud.material.pointSizeType = pst;
851-
//}
869+
pointcloud.material.pointSizeType = pointSizeType;
852870
pointcloud.material.pointShape = (quality === "Circles") ? Potree.PointShape.CIRCLE : Potree.PointShape.SQUARE;
853871
pointcloud.material.interpolate = (quality === "Interpolation");
854872
pointcloud.material.weighted = false;
@@ -948,10 +966,7 @@
948966
rtDepth.setSize(width, height);
949967
rtNormalize.setSize(width, height);
950968

951-
952969
renderer.clear();
953-
//renderer.render(sceneBG, cameraBG);
954-
// render skybox
955970
if(showSkybox){
956971
skybox.camera.rotation.copy(camera.rotation);
957972
renderer.render(skybox.scene, skybox.camera);
@@ -961,71 +976,118 @@
961976
renderer.render(scene, camera);
962977

963978
if(pointcloud){
964-
if(!weightedMaterial){
965-
pointcloud.originalMaterial = pointcloud.material;
966-
depthMaterial = new Potree.PointCloudMaterial();
967-
weightedMaterial = new Potree.PointCloudMaterial();
968-
}
969-
970-
pointcloud.material = depthMaterial;
971-
972-
var bbWorld = Potree.utils.computeTransformedBoundingBox(pointcloud.boundingBox, pointcloud.matrixWorld);
973-
974-
// get rid of this
975-
pointcloud.material.size = pointSize;
976979
pointcloud.visiblePointsTarget = pointCountTarget * 1000 * 1000;
977-
pointcloud.material.opacity = opacity;
980+
978981
pointcloud.material.pointSizeType = pointSizeType;
979-
pointcloud.material.pointColorType = Potree.PointColorType.DEPTH;
980-
pointcloud.material.pointShape = Potree.PointShape.CIRCLE;
981-
pointcloud.material.interpolate = (quality === "Interpolate");
982-
pointcloud.material.weighted = false;
983982

984-
pointcloud.material.minSize = 2;
985-
pointcloud.material.screenWidth = width;
986-
pointcloud.material.screenHeight = height;
987-
988983
pointcloud.update(camera, renderer);
984+
985+
var vn = pointcloud.visibleNodes;
989986

990-
renderer.clearTarget( rtDepth, true, true, true );
991-
renderer.clearTarget( rtNormalize, true, true, true );
992-
993-
var origType = pointcloud.material.pointColorType;
994-
renderer.render(scenePointCloud, camera, rtDepth);
995-
996-
pointcloud.material = weightedMaterial;
997-
987+
// init materials
988+
for(var i = 0; i < vn.length; i++){
989+
var node = vn[i].node;
990+
991+
if(typeof node._hqsplats === "undefined"){
992+
var hq = {
993+
originalMaterial: node.material,
994+
depthMaterial: new Potree.PointCloudMaterial(),
995+
weightedMaterial: new Potree.PointCloudMaterial()
996+
}
997+
998+
hq.depthMaterial.pointColorType = Potree.PointColorType.DEPTH;
999+
hq.depthMaterial.pointShape = Potree.PointShape.CIRCLE;
1000+
hq.depthMaterial.interpolate = false;
1001+
hq.depthMaterial.weighted = false;
1002+
hq.depthMaterial.minSize = 2;
1003+
hq.depthMaterial.uniforms.octreeSize.value = pointcloud.pcoGeometry.boundingBox.size().x;
1004+
hq.depthMaterial.uniforms.bbMin.value = pointcloud.pcoGeometry.boundingBox.min.toArray();
1005+
1006+
hq.weightedMaterial.pointShape = Potree.PointShape.CIRCLE;
1007+
hq.weightedMaterial.interpolate = false;
1008+
hq.weightedMaterial.weighted = true;
1009+
hq.weightedMaterial.minSize = 2;
1010+
hq.weightedMaterial.uniforms.octreeSize.value = pointcloud.pcoGeometry.boundingBox.size().x;
1011+
hq.weightedMaterial.uniforms.bbMin.value = pointcloud.pcoGeometry.boundingBox.min.toArray();
1012+
1013+
node._hqsplats = hq;
1014+
}
1015+
}
9981016

1017+
{// DEPTH PASS
1018+
for(var i = 0; i < vn.length; i++){
1019+
var node = vn[i].node;
1020+
1021+
var material = node._hqsplats.depthMaterial;
1022+
1023+
material.size = pointSize;
1024+
material.pointSizeType = pointSizeType;
1025+
material.screenWidth = width;
1026+
material.screenHeight = height;
1027+
material.uniforms.visibleNodes.value = pointcloud.material.visibleNodesTexture;
1028+
material.uniforms.visibleNodesOffset.value = node._hqsplats.originalMaterial.uniforms.visibleNodesOffset.value;
1029+
material.uniforms.octreeSize.value = pointcloud.pcoGeometry.boundingBox.size().x;
1030+
material.uniforms.bbMin.value = node.pcoGeometry.boundingBox.min.toArray();
1031+
material.uniforms.level.value = node.level;
1032+
material.fov = camera.fov * (Math.PI / 180);
1033+
material.spacing = pointcloud.pcoGeometry.spacing;
1034+
material.near = camera.near;
1035+
material.far = camera.far;
1036+
1037+
node.material = material;
1038+
}
1039+
1040+
renderer.clearTarget( rtDepth, true, true, true );
1041+
renderer.clearTarget( rtNormalize, true, true, true );
1042+
renderer.render(scenePointCloud, camera, rtDepth);
1043+
}
9991044

1000-
// get rid of this
1001-
pointcloud.material.size = pointSize;
1002-
pointcloud.visiblePointsTarget = pointCountTarget * 1000 * 1000;
1003-
pointcloud.material.opacity = opacity;
1004-
pointcloud.material.pointSizeType = pointSizeType;
1005-
pointcloud.material.pointColorType = pointColorType;
1006-
pointcloud.material.pointShape = Potree.PointShape.CIRCLE;
1007-
pointcloud.material.interpolate = (quality === "Interpolation");
1008-
pointcloud.material.weighted = true;
1009-
pointcloud.material.minSize = 2;
10101045

1011-
pointcloud.material.depthMap = rtDepth;
1012-
pointcloud.material.blendDepth = Math.min(pointcloud.material.spacing, 20);
1013-
pointcloud.update(camera, renderer);
1014-
renderer.render(scenePointCloud, camera, rtNormalize);
1046+
{// ATTRIBUTE PASS
1047+
for(var i = 0; i < vn.length; i++){
1048+
var node = vn[i].node;
1049+
1050+
var material = node._hqsplats.weightedMaterial;
1051+
1052+
material.size = pointSize;
1053+
material.pointSizeType = pointSizeType;
1054+
material.screenWidth = width;
1055+
material.screenHeight = height;
1056+
material.pointColorType = pointColorType;
1057+
material.depthMap = rtDepth;
1058+
material.uniforms.visibleNodes.value = pointcloud.material.visibleNodesTexture;
1059+
material.uniforms.visibleNodesOffset.value = node._hqsplats.originalMaterial.uniforms.visibleNodesOffset.value;
1060+
material.uniforms.octreeSize.value = pointcloud.pcoGeometry.boundingBox.size().x;
1061+
material.uniforms.bbMin.value = node.pcoGeometry.boundingBox.min.toArray();
1062+
material.uniforms.level.value = node.level;
1063+
material.fov = camera.fov * (Math.PI / 180);
1064+
material.spacing = pointcloud.pcoGeometry.spacing;
1065+
material.near = camera.near;
1066+
material.far = camera.far;
1067+
1068+
node.material = material;
1069+
}
1070+
1071+
renderer.render(scenePointCloud, camera, rtNormalize);
1072+
}
10151073

1016-
1017-
volumeTool.render();
1074+
// NORMALIZATION PASS
10181075
renderer.render(sceneNormalize, cameraBG);
10191076

1077+
// reset material
1078+
for(var i = 0; i < vn.length; i++){
1079+
var node = vn[i].node;
1080+
1081+
node.material = node._hqsplats.originalMaterial;
1082+
}
1083+
10201084

1085+
volumeTool.render();
10211086
renderer.clearDepth();
10221087
profileTool.render();
10231088
measuringTool.render();
10241089
transformationTool.render();
1025-
10261090
}
1027-
1028-
10291091
}
10301092

10311093
function loop() {
@@ -1044,7 +1106,6 @@
10441106

10451107

10461108
initThree();
1047-
//initGUI();
10481109
loop();
10491110

10501111
</script>

PotreeConverter/src/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ int main(int argc, char **argv){
222222
ssSettings << "\tcameraTarget: null, // other options: cameraTarget: [0,0,0]," << endl;
223223
ssSettings << "\tfov: 60, // field of view in degrees," << endl;
224224
ssSettings << "\tsizeType: \"Adaptive\", // other options: \"Fixed\", \"Attenuated\"" << endl;
225-
ssSettings << "\tquality: \"Squares\", // other options: \"Circles\", \"Interpolation\", \"Splats\"" << endl;
225+
ssSettings << "\tquality: null, // other options: \"Circles\", \"Interpolation\", \"Splats\"" << endl;
226226
ssSettings << "\tmaterial: \"RGB\", // other options: \"Height\", \"Intensity\", \"Classification\"" << endl;
227227
ssSettings << "\tpointLimit: 1, // max number of points in millions" << endl;
228228
ssSettings << "\tpointSize: 1, // " << endl;

README.md

+7
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ Linux/MacOSX:
2626
make
2727

2828
# copy ./PotreeConverter/resources/page_template to your binary working directory.
29+
30+
Linux with custom builds of liblas and laszip
31+
32+
```
33+
mkdir build && cd build
34+
cmake -DCMAKE_BUILD_TYPE=Release -DLIBLAS_INCLUDE_DIR=/opt/source/libLAS-1.8.0/build/include/ -DLIBLAS_LIBRARY=/opt/source/libLAS-1.8.0/build/lib/liblas.so -DLASZIP_INCLUDE_DIR=/opt/source/laszip-2.1.0/build/include -DLASZIP_LIBRARY=/opt/source/laszip-2.1.0/build/lib/liblaszip.so ..
35+
```
2936

3037
Ubuntu:
3138

0 commit comments

Comments
 (0)