Merge pull request #173 from potree/develop

Develop
This commit is contained in:
Markus Schütz 2015-09-13 09:51:06 +02:00
commit 701519986b
333 changed files with 11082 additions and 3973 deletions

View File

@ -4,17 +4,18 @@
* [Getting Started](./docs/getting_started.md)
* [Changelog](./docs/changelog.md)
* [User Interface](./docs/user_interface.md)
* [Converting Point Clouds](./docs/converting.md)
* [FAQ](./docs/faq.md)
* [Measuring](./docs/measuring.md)
* [File Format](./docs/file_format.md)
## About
Potree is a free open-source WebGL based point cloud renderer for large point clouds.
Similar to map software like Google Maps or OpenStreeMap, only data inside the visible area and up to a certain level of detail are loaded.
![](./docs/images/potree_screens.png)
It is based on the [TU Wien Scanopy project](https://www.cg.tuwien.ac.at/research/projects/Scanopy/)
<a href="http://potree.org/wp/demo/" target="_blank"> ![](./docs/images/potree_screens.png) </a>
At the moment, this project is continued as master thesis under the [Harvest4D Project](https://harvest4d.org/)
@ -22,11 +23,11 @@ Newest information and work in progress is usually available on [twitter](https:
General infos, downloads, showcase, etc. at [potree.org](http://potree.org/)
Contact: Markus Schütz - mschuetz@potree.org
## Downloads
* [PotreeConverter 1.2, windows 64bit](https://github.com/potree/PotreeConverter/releases/tag/1.2)
* [PotreeConverter 1.1.1, windows 64bit](http://potree.org/downloads/PotreeConverter/PotreeConverter_1.1.1.zip)
* [PotreeConverter 1.0, windows 64bit](http://potree.org/downloads/PotreeConverter/PotreeConverter_2014.12.30.zip)
[PotreeConverter source and Win64 binaries](https://github.com/potree/PotreeConverter/releases)
## Showcase
@ -43,15 +44,12 @@ Take a look at the [potree showcase](http://potree.org/wp/demo/) for some live e
| Opera | Android | partially works, GUI and stability issues and slow |
| Chrome | Android | works |
## Roadmap
see [Roadmap](https://github.com/potree/potree/wiki/Roadmap)
## Credits
* The multi-res-octree algorithms used by this viewer were developed at the Vienna University of Technology by Michael Wimmer and Claus Scheiblauer as part of the [Scanopy Project](http://www.cg.tuwien.ac.at/research/projects/Scanopy/).
* [Three.js](https://github.com/mrdoob/three.js), the WebGL 3D rendering library on which potree is built.
* [plas.io](http://plas.io/) point cloud viewer. LAS and LAZ support have been taken from the laslaz.js implementation of plas.io. Thanks to [Uday Verma](https://twitter.com/udaykverma) and [Howard Butler](https://twitter.com/howardbutler) for this!
* [Harvest4D](https://harvest4d.org/) Potree currently runs as Master Thesis under the Harvest4D Project
* Christian Boucheny (EDL developer) and Daniel Girardeau-Montaut ([CloudCompare](http://www.danielgm.net/cc/)). The EDL shader was adapted from the CloudCompare source code!
* [Martin Isenburg](http://rapidlasso.com/), [Georepublic](http://georepublic.de/en/),
[Veesus](http://veesus.com/), [Sigeom Sa](http://www.sigeom.ch/), [SITN](http://www.ne.ch/sitn), [Pix4D](http://pix4d.com/) as well as all the contributers to potree and PotreeConverter and many more for their support.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -23,10 +23,10 @@ Potree.Shaders["pointcloud.vs"] = [
"",
"#define max_clip_boxes 30",
"",
"",
"attribute float intensity;",
"attribute float classification;",
"attribute float returnNumber;",
"attribute float numberOfReturns;",
"attribute float pointSourceID;",
"attribute vec4 indices;",
"",
@ -63,8 +63,8 @@ Potree.Shaders["pointcloud.vs"] = [
"",
"varying float vOpacity;",
"varying vec3 vColor;",
"varying float vDepth;",
"varying float vLinearDepth;",
"varying float vLogDepth;",
"varying vec3 vViewPosition;",
"varying float vRadius;",
"varying vec3 vWorldPosition;",
@ -218,9 +218,16 @@ Potree.Shaders["pointcloud.vs"] = [
" gl_Position = projectionMatrix * mvPosition;",
" vOpacity = opacity;",
" vLinearDepth = -mvPosition.z;",
" vDepth = mvPosition.z / gl_Position.w;",
" vNormal = normalize(normalMatrix * normal);",
"",
" ",
" #if defined(use_edl)",
" vLogDepth = log2(gl_Position.w + 1.0) / log2(far + 1.0);",
" #endif",
" ",
" //#if defined(use_logarithmic_depth_buffer)",
" // float logarithmicZ = (2.0 * log2(gl_Position.w + 1.0) / log2(far + 1.0) - 1.0) * gl_Position.w;",
" // gl_Position.z = logarithmicZ;",
" //#endif",
"",
" // ---------------------",
" // POINT COLOR",
@ -233,8 +240,9 @@ Potree.Shaders["pointcloud.vs"] = [
" float w = (world.y - heightMin) / (heightMax-heightMin);",
" vColor = texture2D(gradient, vec2(w,1.0-w)).rgb;",
" #elif defined color_type_depth",
" float d = -mvPosition.z ;",
" vColor = vec3(d, vDepth, 0.0);",
" float linearDepth = -mvPosition.z ;",
" float expDepth = (gl_Position.z / gl_Position.w) * 0.5 + 0.5;",
" vColor = vec3(linearDepth, expDepth, 0.0);",
" #elif defined color_type_intensity",
" float w = (intensity - intensityMin) / (intensityMax - intensityMin);",
" vColor = vec3(w, w, w);",
@ -253,9 +261,27 @@ Potree.Shaders["pointcloud.vs"] = [
" float c = mod(classification, 16.0);",
" vec2 uv = vec2(c / 255.0, 0.5);",
" vColor = texture2D(classificationLUT, uv).rgb;",
" ",
" // TODO only for testing - removing points with class 7",
" if(classification == 7.0){",
" gl_Position = vec4(100.0, 100.0, 100.0, 0.0);",
" }",
" #elif defined color_type_return_number",
" float w = (returnNumber - 1.0) / 4.0 + 0.1;",
" vColor = texture2D(gradient, vec2(w, 1.0 - w)).rgb;",
" //float w = (returnNumber - 1.0) / 4.0 + 0.1;",
" //vColor = texture2D(gradient, vec2(w, 1.0 - w)).rgb;",
" ",
" if(numberOfReturns == 1.0){",
" vColor = vec3(1.0, 1.0, 0.0);",
" }else{",
" if(returnNumber == 1.0){",
" vColor = vec3(1.0, 0.0, 0.0);",
" }else if(returnNumber == numberOfReturns){",
" vColor = vec3(0.0, 0.0, 1.0);",
" }else{",
" vColor = vec3(0.0, 1.0, 0.0);",
" }",
" }",
" ",
" #elif defined color_type_source",
" float w = mod(pointSourceID, 10.0) / 10.0;",
" vColor = texture2D(gradient, vec2(w,1.0 - w)).rgb;",
@ -366,6 +392,7 @@ Potree.Shaders["pointcloud.fs"] = [
" uniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];",
" uniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];",
" uniform float pointLightDistance[ MAX_POINT_LIGHTS ];",
" uniform float pointLightDecay[ MAX_POINT_LIGHTS ];",
"",
" #endif",
"",
@ -403,7 +430,7 @@ Potree.Shaders["pointcloud.fs"] = [
"varying vec3 vColor;",
"varying float vOpacity;",
"varying float vLinearDepth;",
"varying float vDepth;",
"varying float vLogDepth;",
"varying vec3 vViewPosition;",
"varying float vRadius;",
"varying vec3 vWorldPosition;",
@ -413,6 +440,9 @@ Potree.Shaders["pointcloud.fs"] = [
"",
"void main() {",
"",
" vec3 color = vColor;",
" float depth = gl_FragCoord.z;",
"",
" #if defined(circle_point_shape) || defined(use_interpolation) || defined (weighted_splats)",
" float u = 2.0 * gl_PointCoord.x - 1.0;",
" float v = 2.0 * gl_PointCoord.y - 1.0;",
@ -427,25 +457,34 @@ Potree.Shaders["pointcloud.fs"] = [
" ",
" #if defined weighted_splats",
" vec2 uv = gl_FragCoord.xy / vec2(screenWidth, screenHeight);",
" float depth = texture2D(depthMap, uv).r;",
" if(vLinearDepth > depth + vRadius){",
" float sDepth = texture2D(depthMap, uv).r;",
" if(vLinearDepth > sDepth + vRadius){",
" discard;",
" }",
" #endif",
" ",
" #if defined use_interpolation",
" float w = 1.0 - ( u*u + v*v);",
" float wi = 0.0 - ( u*u + v*v);",
" vec4 pos = vec4(-vViewPosition, 1.0);",
" pos.z += w * vRadius;",
" pos.z += wi * vRadius;",
" float linearDepth = pos.z;",
" pos = projectionMatrix * pos;",
" pos = pos / pos.w;",
" gl_FragDepthEXT = (pos.z + 1.0) / 2.0;",
" float expDepth = pos.z;",
" depth = (pos.z + 1.0) / 2.0;",
" gl_FragDepthEXT = depth;",
" ",
" #if defined(color_type_depth)",
" color.r = linearDepth;",
" color.g = expDepth;",
" #endif",
" ",
" #endif",
" ",
" #if defined color_type_point_index",
" gl_FragColor = vec4(vColor, pcIndex / 255.0);",
" gl_FragColor = vec4(color, pcIndex / 255.0);",
" #else",
" gl_FragColor = vec4(vColor, vOpacity);",
" gl_FragColor = vec4(color, vOpacity);",
" #endif",
" ",
" #if defined weighted_splats",
@ -576,6 +615,11 @@ Potree.Shaders["pointcloud.fs"] = [
"",
" #endif",
" ",
" ",
" #if defined(use_edl)",
" gl_FragColor.a = vLogDepth;",
" #endif",
" ",
"}",
"",
"",
@ -603,12 +647,169 @@ Potree.Shaders["normalize.fs"] = [
"varying vec2 vUv;",
"",
"void main() {",
" vec4 color = texture2D(texture, vUv); ",
" float depth = texture2D(depthMap, vUv).g; ",
" ",
" if(depth <= 0.0){",
" discard;",
" }",
" ",
" vec4 color = texture2D(texture, vUv); ",
" color = color / color.w;",
" gl_FragColor = color; ",
" ",
" gl_FragColor = vec4(color.xyz, 1.0); ",
" ",
" gl_FragDepthEXT = depth;",
"}",
].join("\n");
Potree.Shaders["edl.vs"] = [
"",
"",
"varying vec2 vUv;",
"",
"void main() {",
" vUv = uv;",
" ",
" vec4 mvPosition = modelViewMatrix * vec4(position,1.0);",
"",
" gl_Position = projectionMatrix * mvPosition;",
"}",
].join("\n");
Potree.Shaders["edl.fs"] = [
"",
"// ",
"// adapted from the EDL shader code from Christian Boucheny in cloud compare:",
"// https://github.com/cloudcompare/trunk/tree/master/plugins/qEDL/shaders/EDL",
"//",
"",
"#define NEIGHBOUR_COUNT 8",
"",
"uniform mat4 projectionMatrix;",
"",
"uniform float screenWidth;",
"uniform float screenHeight;",
"uniform float near;",
"uniform float far;",
"uniform vec2 neighbours[NEIGHBOUR_COUNT];",
"uniform vec3 lightDir;",
"uniform float expScale;",
"uniform float radius;",
"",
"//uniform sampler2D depthMap;",
"uniform sampler2D colorMap;",
"",
"varying vec2 vUv;",
"",
"/**",
" * transform linear depth to [0,1] interval with 1 beeing closest to the camera.",
" */",
"float ztransform(float linearDepth){",
" return 1.0 - (linearDepth - near) / (far - near);",
"}",
"",
"float expToLinear(float z){",
" z = 2.0 * z - 1.0;",
" float linear = (2.0 * near * far) / (far + near - z * (far - near));",
"",
" return linear;",
"}",
"",
"// this actually only returns linear depth values if LOG_BIAS is 1.0",
"// lower values work out more nicely, though.",
"#define LOG_BIAS 0.01",
"float logToLinear(float z){",
" return (pow((1.0 + LOG_BIAS * far), z) - 1.0) / LOG_BIAS;",
"}",
"",
"float obscurance(float z, float dist){",
" return max(0.0, z) / dist;",
"}",
"",
"float computeObscurance(float linearDepth){",
" vec4 P = vec4(0, 0, 1, -ztransform(linearDepth));",
" vec2 uvRadius = radius / vec2(screenWidth, screenHeight);",
" ",
" float sum = 0.0;",
" ",
" for(int c = 0; c < NEIGHBOUR_COUNT; c++){",
" vec2 N_rel_pos = uvRadius * neighbours[c];",
" vec2 N_abs_pos = vUv + N_rel_pos;",
" ",
" float neighbourDepth = logToLinear(texture2D(colorMap, N_abs_pos).a);",
" ",
" if(neighbourDepth != 0.0){",
" float Zn = ztransform(neighbourDepth);",
" float Znp = dot( vec4( N_rel_pos, Zn, 1.0), P );",
" ",
" sum += obscurance( Znp, 0.05 * linearDepth );",
" }",
" }",
" ",
" return sum;",
"}",
"",
"void main(){",
" float linearDepth = logToLinear(texture2D(colorMap, vUv).a);",
" ",
" float f = computeObscurance(linearDepth);",
" f = exp(-expScale * f);",
" ",
" vec4 color = texture2D(colorMap, vUv);",
" if(color.a == 0.0 && f >= 1.0){",
" discard;",
" }",
" ",
" gl_FragColor = vec4(color.rgb * f, 1.0);",
"}",
"",
].join("\n");
Potree.Shaders["blur.vs"] = [
"",
"varying vec2 vUv;",
"",
"void main() {",
" vUv = uv;",
"",
" gl_Position = projectionMatrix * modelViewMatrix * vec4(position,1.0);",
"}",
].join("\n");
Potree.Shaders["blur.fs"] = [
"",
"uniform mat4 projectionMatrix;",
"",
"uniform float screenWidth;",
"uniform float screenHeight;",
"uniform float near;",
"uniform float far;",
"",
"uniform sampler2D map;",
"",
"varying vec2 vUv;",
"",
"void main() {",
"",
" float dx = 1.0 / screenWidth;",
" float dy = 1.0 / screenHeight;",
"",
" vec3 color = vec3(0.0, 0.0, 0.0);",
" color += texture2D(map, vUv + vec2(-dx, -dy)).rgb;",
" color += texture2D(map, vUv + vec2( 0, -dy)).rgb;",
" color += texture2D(map, vUv + vec2(+dx, -dy)).rgb;",
" color += texture2D(map, vUv + vec2(-dx, 0)).rgb;",
" color += texture2D(map, vUv + vec2( 0, 0)).rgb;",
" color += texture2D(map, vUv + vec2(+dx, 0)).rgb;",
" color += texture2D(map, vUv + vec2(-dx, dy)).rgb;",
" color += texture2D(map, vUv + vec2( 0, dy)).rgb;",
" color += texture2D(map, vUv + vec2(+dx, dy)).rgb;",
" ",
" color = color / 9.0;",
" ",
" gl_FragColor = vec4(color, 1.0);",
" ",
" ",
"}",
].join("\n");

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,46 +0,0 @@
# Converting Point Clouds
This section explains how to use the [PotreeConverter](https://github.com/potree/PotreeConverter) to convert point clouds.
If you want to get the best out of potree, you might want to consider following points:
* The resulting data/r* files should idealy be smaller than 60k poins (~1mb). Larger files will increase load times and reduce the rendering efficiency.
* There should not be too much very small data/*r files. (like 60% files with <10kb).
A lot of small files will result in a large amount of small nodes being rendered at run time and a large amount of small nodes can decrease performance just as much as a small amount of too large nodes. (large with respect to the amount of points they contain)
* When using the adaptive point size mode, you might get better results if you don't try convert all points, i.e. choose a lower depth or higher spacing. This is because adaptive point size reduces the point size for each node that has been loaded but if a high level node does not have enough points to cover up for the reduced point size, holes will appear.
## Getting Started
For your first conversion, try this:
```
./PotreeConverter.exe pointcloud.las -l 3 --scale 0.01
```
It will create an octree hierarchy with a depth of 0-3. A higher depth will increase the amount of details but it shouldn't be set arbitrarely high. Read about the options to learn about good values.
The scale parameter specifies the coordinate precision.
Somewhere in the command line you'll get this output:
```
spacing calculated from diagonal: 0.5
Last level will have spacing: 0.0625
```
The spacing is the distance between points, not to be confused with coordinate precision. With each level, the distance between points is halved. The final spacing at the lowest level is calculated with (spacing) / 2 ^ levels.
In this case, points at the root level have a distance of 0.5 from each other and at the lowest level their distance is 0.0625. If the unit is meters, this means that your result will have a spacing of 6.25cm. The actual precision of the coordinates is set with the scale parameter and independant of the spacing!
## Options
__-l (octree depth):__ Number of octree levels. Use 3 or 4 for smaller point clouds (~5m) and 8-10 for large point clouds (500m - 18b). With each level, the amount of detail increases. This option should not be set too high and may require some trial and error. __Affects the number of nodes in the output!__. Increase the octree depth to get more details and more files and vice versa. If you get too much small files, decrease this.
__-s (spacing):__ Distance between points at root level. At each level down the hierarchy, the spacing is halved. If this parameter is omitted, a default value is calculated from the diagonal of the bounding box. __Affects the file size of the nodes in the output!__ Lower the spacing to get larger files with more points and vice versa.
__-i (input files and directories):__ If a directory is specified, all files inside the directory will be converted. Multiple files and directories may be specified.
__-o (output directory):__
__--output-format:__ May be either BINARY (default), LAS or LAZ. As of now, BINARY only supports coordinate position and point colors. LAS and LAZ files can also handle intensity, classification, return number and point source id. LAZ is a compressed format that produces the smallest output(~1/3 of binary format) but comes at a higher CPU and memory cost.

View File

@ -28,13 +28,12 @@ browser with ```http://localhost```
### Converting & Generating a Web Page
Try this for your first point cloud and then take a look at [conversion manual](converting.md) to learn more about the converter options to get better results:
Try this for your first point cloud and then take a look at the [PotreeConverter page](https://github.com/potree/PotreeConverter) to learn more about the converter options:
```
./PotreeConverter.exe C:/pointcloud.las -o C:/xampp/htdocs/potree -l 3 --generate-page
./PotreeConverter.exe C:/pointcloud.las -o C:/xampp/htdocs/potree --generate-page pageName
```
You should now be able to open the generated potree page at this URL: ```http://localhost/potree/examples/pointcloud.html```
You should now be able to open the generated potree page at this URL: ```http://localhost/potree/examples/pageName.html```
![](images/lion_demo_screenshot.jpg)

View File

@ -1,15 +0,0 @@
# Measuring
if you're missing some functionality in the interface, you can still achieve certain things by using your browsers developer tools as a scripting console. Open the developer tools with ctrl + shift + i, paste code into the console and execute it.
## Height Profile
To get points inside a height profile, use this:
```
var maxOctreeDepth = 2;
var points = pointcloud.getPointsInProfile(profileTool.profiles[0], maxOctreeDepth);
console.log(points);
```

View File

@ -161,7 +161,8 @@ void main() {
material: "RGB", // other options: "Height", "Intensity", "Classification"
pointLimit: 1, // max number of points in millions
navigation: "Orbit", // other options: "Earth", "Orbit", "Flight"
pointSize: 2.0
pointSize: 2.0,
useEDL: false
};
</script>
<script src="./js/viewer.js"></script>

299
examples/cesium.html Normal file
View File

@ -0,0 +1,299 @@
<!DOCTYPE html>
<html lang="en">
<!--
Thanks for help with this to Matthias Adorjan
-->
<head>
<link rel="stylesheet" type="text/css" href="css/potree.css">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<!-- Make the application on mobile take up the full browser screen and disable user scaling. -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<title>three.js & Potree & Cesium</title>
<style>
@import url(../libs/Cesium/Widgets/widgets.css);
body{
margin: 0;
padding: 0;
}
#cesiumContainer{
position: absolute;
width: 100%;
height: 100%;
}
a:hover, a:visited, a:link, a:active{
color: #ccccff;
text-decoration: none;
}
</style>
</head>
<body>
<div id="cesiumContainer"></div>
<div class="info" style="position: absolute; left: 300px; right: 300px; top: 10px; text-align: center;">
Rendering a <a href="http://threejs.org/" target="_blank">three.js</a> / <a href="http://potree.org/" target="_blank">Potree</a> point cloud in
<a href="https://cesiumjs.org/" target="_blank">Cesium</a><br>
Point cloud courtesy of <a href="http://sigeom.ch/" target="_blank">sigeom sa</a>
</div>
<script src="../libs/Cesium/Cesium.js"></script>
<script src="../libs/other/stats.min.js"></script>
<script src="../libs/other/dat.gui.min.js"></script>
<script src="../libs/other/BinaryHeap.js"></script>
<script src="../libs/proj4/proj4.js"></script>
<script src="../libs/three.js/build/three.js"></script>
<script src="../build/js/potree.js"></script>
<script src="../src/PointCloudOctree.js"></script>
<script src="../src/PointCloudOctreeGeometry.js"></script>
<script src="../src/loader/POCLoader.js"></script>
<script src="../src/loader/BinaryLoader.js"></script>
<script src="../src/loader/LasLazLoader.js"></script>
<script src="../src/materials/PointCloudMaterial.js"></script>
<script src="../src/materials/EyeDomeLightingMaterial.js"></script>
<script src="../src/EarthControls.js"></script>
<script src="../src/OrbitControls.js"></script>
<script src="../src/FirstPersonControls.js"></script>
<script src="../src/utils/ProfileTool.js"></script>
<script src="../src/utils/MeasuringTool.js"></script>
<script src="../src/utils/TransformationTool.js"></script>
<script src="../src/utils/VolumeTool.js"></script>
<script src="../src/utils.js"></script>
<script src="../src/LRU.js"></script>
<script src="../src/TextSprite.js"></script>
<script src="../src/Features.js"></script>
<script src="../src/arena4d/PointCloudArena4D.js"></script>
<script src="../src/arena4d/PointCloudArena4DGeometry.js"></script>
<script>
// add EPSG:21781 projection definition
proj4.defs('EPSG:21781', "+proj=somerc +lat_0=46.95240555555556 +lon_0=7.439583333333333 +k_0=1 +x_0=600000 +y_0=200000 +ellps=bessel +towgs84=674.4,15.1,405.3,0,0,0,0 +units=m +no_defs ");
var swiss = proj4.defs("EPSG:21781");
var WGS84 = proj4.defs("WGS84");
var webMercator = proj4.defs("EPSG:3857");
// boundaries in EPSG:21781
var minSwiss = [589500, 231300, 722.505];
var maxSwiss = [590099, 231565.743, 776.4590];
// boundaries in WGS84
var minWGS84 = proj4(swiss, WGS84, [minSwiss[0], minSwiss[1]]);
var maxWGS84 = proj4(swiss, WGS84, [maxSwiss[0], maxSwiss[1]]);
var cesiumContainer = document.getElementById("cesiumContainer");
var three = {
renderer: null,
camera: null,
scene: null
};
var cesium = {
viewer: null
};
var potree = {
pointcloud: null
};
function initCesium(){
cesium.viewer = new Cesium.Viewer('cesiumContainer', {
useDefaultRenderLoop: false,
fullscreenButton: false,
animation: false,
baseLayerPicker: false,
geocoder: false,
homeButton: false,
infoBox: false,
sceneModePicker: false,
selectionIndicator: false,
timeline: false,
navigationHelpButton: false,
navigationInstructionsInitiallyVisible: false
});
// create polygon from boundaries in WGS84
var entity = {
name : 'Wyoming',
polygon : {
hierarchy : Cesium.Cartesian3.fromDegreesArray([
minWGS84[0], minWGS84[1],
maxWGS84[0], minWGS84[1],
maxWGS84[0], maxWGS84[1],
minWGS84[0], maxWGS84[1],
]),
material : Cesium.Color.RED.withAlpha(0.2),
outline : true,
outlineColor : Cesium.Color.BLACK
}
};
var wyoming = cesium.viewer.entities.add(entity);
var center = Cesium.Cartesian3.fromDegrees(
(minWGS84[0] + maxWGS84[0]) / 2,
(minWGS84[1] + maxWGS84[1]) / 2,
1000
);
var cp = new Cesium.Cartesian3(4303414.154026048, 552161.235598733, 4660771.704035539);
cesium.viewer.camera.setView({
position : cp,
heading : 10,
//pitch : -Cesium.Math.PI_OVER_TWO,
pitch : -Cesium.Math.PI_OVER_TWO * 0.5,
roll : 0
});
}
function initThree(){
var fov = 75;
var width = 1;
var height = 1;
var aspect = width / height;
var near = 1;
var far = 10*1000*1000;
three.scene = new THREE.Scene();
three.camera = new THREE.PerspectiveCamera(fov, aspect, near, far);
three.renderer = new THREE.WebGLRenderer({alpha: true, canvas: cesium.viewer.canvas});
three.renderer.autoClear = false;
three.camera.position.set(200,200,200);
three.camera.lookAt(new THREE.Vector3(0,0,0));
Potree.POCLoader.load("../resources/pointclouds/vol_total/cloud.js", function(geometry){
var pointcloud = new Potree.PointCloudOctree(geometry);
pointcloud.material.pointSizeType = Potree.PointSizeType.ADAPTIVE;
pointcloud.material.size = 1;
three.scene.add(pointcloud);
potree.pointcloud = pointcloud;
});
}
function renderCesium(){
cesium.viewer.forceResize();
cesium.viewer.render();
}
function renderPotree(){
// register threejs scene with cesium
if(potree.pointcloud){
three.camera.fov = Cesium.Math.toDegrees(cesium.viewer.camera.frustum.fovy)
three.camera.updateProjectionMatrix();
var cartToVec = function(cart){
return new THREE.Vector3(cart.x, cart.y, cart.z);
};
{
//potree.pointcloud.showBoundingBox = true;
var bottomLeft = cartToVec(Cesium.Cartesian3.fromDegrees(minWGS84[0], minWGS84[1]));
var topLeft = cartToVec(Cesium.Cartesian3.fromDegrees(minWGS84[0], maxWGS84[1]));
var bottomLeftHigh = cartToVec(Cesium.Cartesian3.fromDegrees(minWGS84[0], minWGS84[1], 1));
potree.pointcloud.position.copy(bottomLeft);
potree.pointcloud.lookAt(bottomLeftHigh);
// use direction from bottom left to top left as up-vector
var latDir = new THREE.Vector3().subVectors(topLeft, bottomLeft).normalize();
potree.pointcloud.up.copy(latDir);
}
three.camera.matrixAutoUpdate = false;
var cvm = cesium.viewer.camera.viewMatrix;
var civm = cesium.viewer.camera.inverseViewMatrix;
three.camera.matrixWorld.set(
civm[0], civm[4], civm[8 ], civm[12],
civm[1], civm[5], civm[9 ], civm[13],
civm[2], civm[6], civm[10], civm[14],
civm[3], civm[7], civm[11], civm[15]
);
three.camera.matrixWorldInverse.set(
cvm[0], cvm[4], cvm[8 ], cvm[12],
cvm[1], cvm[5], cvm[9 ], cvm[13],
cvm[2], cvm[6], cvm[10], cvm[14],
cvm[3], cvm[7], cvm[11], cvm[15]
);
three.camera.lookAt(new THREE.Vector3(0,0,0));
}
var width = cesiumContainer.clientWidth;
var height = cesiumContainer.clientHeight;
var aspect = width / height;
three.camera.aspect = aspect;
//three.camera.near = cesium.viewer.camera.frustum.near;
//three.camera.far = cesium.viewer.camera.frustum.far;
three.camera.updateProjectionMatrix();
three.renderer.setSize(width, height);
// In order to be able to render into the same canvas as cesium,
// WebGLRenderer._currentProgram has to be set to null before using the three.js render function.
// since _currentProgram is a private variable, this can only be done through WebGLRenderer.resetGLState();
// resetGLState(), however, also calls state.reset which causes errors.
// This workaround therefore temporarily changes the state.reset reset function to an empty function
var resetFunc = three.renderer.state.reset;
three.renderer.state.reset = function(){};
three.renderer.resetGLState();
three.renderer.state.reset = resetFunc;
three.renderer.context.enable(three.renderer.context.DEPTH_TEST);
three.renderer.clearDepth();
three.renderer.render(three.scene, three.camera);
}
function update(){
if(potree.pointcloud){
potree.pointcloud.update(three.camera, three.renderer);
}
}
function loop(){
requestAnimationFrame(loop);
update();
renderCesium();
renderPotree();
}
initCesium();
initThree();
loop();
</script>
</body>
</html>

130
examples/heightProfile.html Normal file
View File

@ -0,0 +1,130 @@
<html>
<head>
<meta charset="utf-8"/>
<title>Potree Viewer</title>
<link rel="stylesheet" type="text/css" href="css/potree.css">
</head>
<body>
<script src="../libs/three.js/build/three.js"></script>
<script src="../libs/other/stats.min.js"></script>
<script src="../libs/other/dat.gui.min.js"></script>
<script src="../libs/other/BinaryHeap.js"></script>
<script src="../build/js/potree.js"></script>
<script src="./js/ProgressBar.js"></script>
<!-- INCLUDE ADDITIONAL DEPENDENCIES HERE -->
<!-- INCLUDE SETTINGS HERE -->
<!--<script src="../libs/plasio/js/laslaz.js"></script>
<script src="../libs/plasio/vendor/bluebird.js"></script>
<script src="../build/js/laslaz.js"></script>-->
<!-- HEADING -->
<div class="info" style="position: absolute; left: 300px; right: 300px; top: 10px; text-align: center;">
<a href="http://potree.org" target="_blank">potree.org</a><br>
Point cloud courtesy of <a href="http://www.sigeom.ch/" target="_blank">sigeom sa</a><br>
</div>
<!-- INFOS / STATS -->
<div id="lblNumVisibleNodes" class="info" style="position: absolute; left: 10px; top: 80px; width: 400px; color:white"></div>
<div id="lblNumVisiblePoints" class="info" style="position: absolute; left: 10px; top: 100px; width: 400px; color:white"></div>
<div id="lblMessage" class="info" style="position: absolute; left: 10px; bottom: 0px; width: 400px; color:white"></div>
<div id="renderArea"></div>
<script>
var sceneProperties = {
path: "http://5.9.65.151/mschuetz/potree/resources/pointclouds/pix4d/matterhorn/cloud.js",
path: "http://5.9.65.151/mschuetz/potree/test/cloud.js",
path: "../resources/pointclouds/lion_takanawa/cloud.js",
path: "http://localhost/temp/test/cloud.js",
path: "../resources/pointclouds/vol_total/cloud.js",
cameraPosition: null,
cameraTarget: null,
sizeType: "Fixed", // options: "Fixed", "Attenuated", "Adaptive"
quality: "Squares", // options: "Squares", "Circles", "Interpolation", "Splats"
fov: 75, // field of view in degree
material: "RGB", // options: "RGB", "Height", "Intensity", "Classification"
pointLimit: 1, // max number of points in millions
navigation: "Orbit", // options: "Earth", "Orbit", "Flight"
pointSize: 2,
useEDL: false, // eye-dome-lighting, especially usefull for point clouds without normals
};
</script>
<script src="./js/viewer.js"></script>
<canvas id="cHeightProfile" width="300" height="300"
style="position: absolute; width: 300px; height: 300px; left: 10px; bottom: 10px; border: 1px solid black; pointer-events: none"></canvas>
<script>
// create a profile with 3 markers / 2 segments
var profile = new Potree.HeightProfile();
profile.addMarker(new THREE.Vector3(-294, 59, 95));
profile.addMarker(new THREE.Vector3(-179, 55, -1));
profile.addMarker(new THREE.Vector3(-69,33,-39));
profile.setWidth(3);
profileTool.addProfile(profile);
// profile will be drawn into this canvas
var canvas = document.getElementById("cHeightProfile"),
context = canvas.getContext("2d");
context.fillStyle = "#000000";
context.fillRect(0, 0, 300, 300);
function update2DProfile(){
// clear canvas
context.clearRect(0, 0, 300, 300);
context.fillStyle = "#000000";
context.fillRect(0, 0, 300, 300);
// set origin to bottom left
context.setTransform(1, 0, 0, 1, 0, 0);
context.translate(0, 300);
context.scale(1, -1);
var result = pointcloud.getPointsInProfile(profile, 2);
var segments = result.segments;
// iterate through all segments of the profile
for(var i = 0; i < segments.length; i++){
var segment = segments[i];
for(var j = 0; j < segment.points.numPoints; j++){
var position = segment.points.position[j];
position = segment.project(position);
var color = segment.points.color[j];
var x = (position.x / result.projectedBoundingBox.max.x) * 300;
var y = (position.y / result.projectedBoundingBox.max.x) * 300;
var r = parseInt(color[0]*255);
var g = parseInt(color[1]*255);
var b = parseInt(color[2]*255);
context.fillStyle = "rgb(" + r + ", " + g + " , " + b + " )";
context.fillRect(x, y, 2, 2);
}
}
setTimeout(update2DProfile, 1000);
}
// uncommenting this updates the profile view every time one of the markers moves
//profile.addEventListener("marker_moved", function(event){
// update2DProfile();
//});
// update profile view every 1000ms
setTimeout(update2DProfile, 1000);
</script>
</body>
</html>

View File

@ -1,100 +0,0 @@
"[ " + camera.position.x.toFixed(2) + ", " + camera.position.y.toFixed(2) + ", " + camera.position.z.toFixed(2) + " ]"
# matterhorn
position: [ 3334.84, 7806.38, -2970.29 ]
lookAt: [ 550.70, 5659.12, -275.78 ]
camera.position.set(3334.84, 7806.38, -2970.29)
camera.lookAt(new THREE.Vector3(550.70, 5659.12, -275.78))
# dechen cave
position: [ -2.12, 14.08, -3.40 ]
lookAt: [ -4.80, 13.80, 1.49 ]
# owl
position: [ -4.27, 7.02, 4.27 ]
lookAt: [ -0.12, 1.63, -0.05 ]
# skatepark
points: 0.6
position: [ 5.10, 195.34, -12.79 ]
lookAt: [ -3.79, 181.82, 5.64 ]
# vol total
position: [ 255.79, 506.62, -233.26 ]
lookAt: [ 117.90, 321.15, -22.44 ]
#eclepens
position: [ 331.55, 890.39, 538.83 ]
lookAt: [ 127.47, 600.93, 88.21 ]
# lion_takanawa
position: [ 3.68, 7.00, 4.37 ]
lookAt: [ 0.27, 4.68, 1.00 ]
# whitby_geom
position: [ 268.87, 539.56, -101.29 ]
lookAt: [ 94.25, 351.57, -0.64 ]
# vienna donaukanal
position: [ 2.96, 17.32, 10.35 ]
lookAt: [ 1.42, 11.58, -0.04 ]
# CA13_SAN_SIM
position: [ -23190.37, 20563.16, -7653.28 ]
lookAt: [ -22959.89, 20435.17, -7879.27 ]
# lake tahoe
points: 1.5
pointSize: 0.6

View File

@ -3,12 +3,12 @@ if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(naviga
sceneProperties.navigation = "Orbit";
}
if(sceneProperties.useEDL && !Potree.Features.SHADER_EDL.isSupported()){
sceneProperties.useEDL = false;
}
if(sceneProperties.quality === null){
if(Potree.Features.SHADER_INTERPOLATION.isSupported()){
sceneProperties.quality = "Interpolation";
}else{
sceneProperties.quality = "Squares";
}
sceneProperties.quality = "Squares";
}
var fov = sceneProperties.fov;
@ -22,7 +22,7 @@ var clipMode = Potree.ClipMode.HIGHLIGHT_INSIDE;
var quality = null;
var isFlipYZ = false;
var useDEMCollisions = false;
var minNodeSize = 150;
var minNodeSize = 100;
var directionalLight;
var showStats = false;
@ -83,7 +83,7 @@ function setMaterial(value){
pointColorType = Potree.PointColorType.RGB;
}else if(value === "Color"){
pointColorType = Potree.PointColorType.COLOR;
}else if(value === "Height"){
}else if(value === "Elevation"){
pointColorType = Potree.PointColorType.HEIGHT;
}else if(value === "Intensity"){
pointColorType = Potree.PointColorType.INTENSITY;
@ -127,6 +127,7 @@ function initGUI(){
"Materials" : sceneProperties.material,
"Clip Mode": "Highlight Inside",
"quality": sceneProperties.quality,
"EDL": sceneProperties.useEDL,
"skybox": false,
"stats": showStats,
"BoundingBox": showBoundingBox,
@ -135,7 +136,7 @@ function initGUI(){
"freeze": freeze
};
var pPoints = gui.add(params, 'points(m)', 0, 2);
var pPoints = gui.add(params, 'points(m)', 0, 4);
pPoints.onChange(function(value){
pointCountTarget = value ;
});
@ -166,7 +167,7 @@ function initGUI(){
var attributes = pointcloud.pcoGeometry.pointAttributes
if(attributes === "LAS" || attributes === "LAZ"){
options = [
"RGB", "Color", "Height", "Intensity", "Intensity Gradient",
"RGB", "Color", "Elevation", "Intensity", "Intensity Gradient",
"Classification", "Return Number", "Source",
"Tree Depth"];
}else{
@ -187,15 +188,16 @@ function initGUI(){
options.push("Normal");
}
options.push("Height");
options.push("Elevation");
options.push("Color");
options.push("Tree Depth");
}
// default material is not available. set material to Height
// default material is not available. set material to Elevation
if(options.indexOf(params.Materials) < 0){
console.error("Default Material '" + params.Material + "' is not available. Using Height instead");
setMaterial("Height");
params.Materials = "Height";
console.error("Default Material '" + params.Material + "' is not available. Using Elevation instead");
setMaterial("Elevation");
params.Materials = "Elevation";
}
@ -216,6 +218,13 @@ function initGUI(){
quality = value;
});
if(Potree.Features.SHADER_EDL.isSupported()){
var pEDL = fAppearance.add(params, 'EDL');
pEDL.onChange(function(value){
sceneProperties.useEDL = value;
});
}
var pSykbox = fAppearance.add(params, 'skybox');
pSykbox.onChange(function(value){
showSkybox = value;
@ -278,7 +287,7 @@ function initThree(){
var height = elRenderArea.clientHeight;
var aspect = width / height;
var near = 0.1;
var far = 1000000;
var far = 1000*1000;
scene = new THREE.Scene();
scenePointCloud = new THREE.Scene();
@ -339,6 +348,18 @@ function initThree(){
referenceFrame.position.copy(sg.center).multiplyScalar(-1);
referenceFrame.updateMatrixWorld(true);
if(sg.radius > 50*1000){
camera.near = 10;
}else if(sg.radius > 10*1000){
camera.near = 2;
}else if(sg.radius > 1000){
camera.near = 1;
}else if(sg.radius > 100){
camera.near = 0.5;
}else{
camera.near = 0.1;
}
flipYZ();
camera.zoomTo(pointcloud, 1);
@ -347,6 +368,8 @@ function initThree(){
earthControls.pointclouds.push(pointcloud);
if(sceneProperties.navigation === "Earth"){
useEarthControls();
}else if(sceneProperties.navigation === "Orbit"){
@ -354,16 +377,24 @@ function initThree(){
}else if(sceneProperties.navigation === "Flight"){
useFPSControls();
}else{
console.warning("No navigation mode specivied. Using OrbitControls");
console.warning("No navigation mode specified. Using OrbitControls");
useOrbitControls();
}
if(sceneProperties.cameraPosition){
camera.position.set(sceneProperties.cameraPosition[0], sceneProperties.cameraPosition[1], sceneProperties.cameraPosition[2]);
if(sceneProperties.cameraPosition != null){
var cp = new THREE.Vector3(sceneProperties.cameraPosition[0], sceneProperties.cameraPosition[1], sceneProperties.cameraPosition[2]);
camera.position.copy(cp);
}
if(sceneProperties.cameraTarget){
camera.lookAt(new THREE.Vector3(sceneProperties.cameraTarget[0], sceneProperties.cameraTarget[1], sceneProperties.cameraTarget[2]));
if(sceneProperties.cameraTarget != null){
var ct = new THREE.Vector3(sceneProperties.cameraTarget[0], sceneProperties.cameraTarget[1], sceneProperties.cameraTarget[2]);
camera.lookAt(ct);
if(sceneProperties.navigation === "Orbit"){
controls.target.copy(ct);
}
}
});
}else if(pointcloudPath.indexOf(".vpc") > 0){
Potree.PointCloudArena4DGeometry.load(pointcloudPath, function(geometry){
@ -407,6 +438,16 @@ function initThree(){
useOrbitControls();
}
if(sceneProperties.cameraPosition != null){
var cp = new THREE.Vector3(sceneProperties.cameraPosition[0], sceneProperties.cameraPosition[1], sceneProperties.cameraPosition[2]);
camera.position.copy(cp);
}
if(sceneProperties.cameraTarget != null){
var ct = new THREE.Vector3(sceneProperties.cameraTarget[0], sceneProperties.cameraTarget[1], sceneProperties.cameraTarget[2]);
camera.lookAt(ct);
}
});
}
@ -534,7 +575,7 @@ function update(){
}
}
if(!heightMin){
if(heightMin === null){
heightMin = bbWorld.min.y;
heightMax = bbWorld.max.y;
}
@ -578,7 +619,7 @@ function update(){
// update progress bar
if(pointcloud){
var progress = pointcloud.progress;;
var progress = pointcloud.progress;
progressBar.progress = progress;
@ -630,6 +671,21 @@ function update(){
pointcloud.material.setClipBoxes(clipBoxes);
}
//if(pointcloud){
//
// var levels = new Uint32Array(20);
//
// var vn = pointcloud.visibleNodes;
// for(var i = 0; i < vn.length; i++){
// var node = vn[i].node;
// var level = node.level;
//
// levels[level]++;
// }
//
// var a;
//}
}
function useEarthControls(){
@ -667,7 +723,7 @@ function useFPSControls(){
controls = fpControls;
controls.enabled = true;
controls.moveSpeed = pointcloud.boundingSphere.radius / 2;
controls.moveSpeed = pointcloud.boundingSphere.radius / 6;
}
function useOrbitControls(){
@ -701,248 +757,429 @@ function useOrbitControls(){
}
}
function render(){
// resize
var width = elRenderArea.clientWidth;
var height = elRenderArea.clientHeight;
var aspect = width / height;
camera.aspect = aspect;
camera.updateProjectionMatrix();
renderer.setSize(width, height);
var PotreeRenderer = function(){
// render skybox
if(showSkybox){
skybox.camera.rotation.copy(camera.rotation);
renderer.render(skybox.scene, skybox.camera);
}else{
renderer.render(sceneBG, cameraBG);
}
if(pointcloud){
if(pointcloud.originalMaterial){
pointcloud.material = pointcloud.originalMaterial;
this.render = function(){
{// resize
var width = elRenderArea.clientWidth;
var height = elRenderArea.clientHeight;
var aspect = width / height;
camera.aspect = aspect;
camera.updateProjectionMatrix();
renderer.setSize(width, height);
}
var bbWorld = Potree.utils.computeTransformedBoundingBox(pointcloud.boundingBox, pointcloud.matrixWorld);
// render skybox
if(showSkybox){
skybox.camera.rotation.copy(camera.rotation);
renderer.render(skybox.scene, skybox.camera);
}else{
renderer.render(sceneBG, cameraBG);
}
pointcloud.visiblePointsTarget = pointCountTarget * 1000 * 1000;
pointcloud.material.size = pointSize;
pointcloud.material.opacity = opacity;
pointcloud.material.pointColorType = pointColorType;
pointcloud.material.pointSizeType = pointSizeType;
pointcloud.material.pointShape = (quality === "Circles") ? Potree.PointShape.CIRCLE : Potree.PointShape.SQUARE;
pointcloud.material.interpolate = (quality === "Interpolation");
pointcloud.material.weighted = false;
}
// render scene
renderer.render(scene, camera);
renderer.render(scenePointCloud, camera);
profileTool.render();
volumeTool.render();
renderer.clearDepth();
measuringTool.render();
transformationTool.render();
}
if(pointcloud){
if(pointcloud.originalMaterial){
pointcloud.material = pointcloud.originalMaterial;
}
var bbWorld = Potree.utils.computeTransformedBoundingBox(pointcloud.boundingBox, pointcloud.matrixWorld);
pointcloud.visiblePointsTarget = pointCountTarget * 1000 * 1000;
pointcloud.material.size = pointSize;
pointcloud.material.opacity = opacity;
pointcloud.material.pointColorType = pointColorType;
pointcloud.material.pointSizeType = pointSizeType;
pointcloud.material.pointShape = (quality === "Circles") ? Potree.PointShape.CIRCLE : Potree.PointShape.SQUARE;
pointcloud.material.interpolate = (quality === "Interpolation");
pointcloud.material.weighted = false;
}
// render scene
renderer.render(scene, camera);
renderer.render(scenePointCloud, camera);
profileTool.render();
volumeTool.render();
renderer.clearDepth();
measuringTool.render();
transformationTool.render();
};
};
var potreeRenderer = new PotreeRenderer();
// high quality rendering using splats
//
var rtDepth = new THREE.WebGLRenderTarget( 1024, 1024, {
minFilter: THREE.NearestFilter,
magFilter: THREE.NearestFilter,
format: THREE.RGBAFormat,
type: THREE.FloatType
} );
var rtNormalize = new THREE.WebGLRenderTarget( 1024, 1024, {
minFilter: THREE.LinearFilter,
magFilter: THREE.NearestFilter,
format: THREE.RGBAFormat,
type: THREE.FloatType
} );
var highQualityRenderer = null;
var HighQualityRenderer = function(){
var sceneNormalize;
var depthMaterial = null;
var attributeMaterial = null;
var normalizationMaterial = null;
var rtDepth;
var rtNormalize;
var initHQSPlats = function(){
if(depthMaterial != null){
return;
}
depthMaterial = new Potree.PointCloudMaterial();
attributeMaterial = new Potree.PointCloudMaterial();
depthMaterial.pointColorType = Potree.PointColorType.DEPTH;
depthMaterial.pointShape = Potree.PointShape.CIRCLE;
depthMaterial.interpolate = false;
depthMaterial.weighted = false;
depthMaterial.minSize = 2;
attributeMaterial.pointShape = Potree.PointShape.CIRCLE;
attributeMaterial.interpolate = false;
attributeMaterial.weighted = true;
attributeMaterial.minSize = 2;
var depthMaterial, weightedMaterial;
rtDepth = new THREE.WebGLRenderTarget( 1024, 1024, {
minFilter: THREE.NearestFilter,
magFilter: THREE.NearestFilter,
format: THREE.RGBAFormat,
type: THREE.FloatType
} );
// render with splats
function renderHighQuality(){
if(!sceneNormalize){
sceneNormalize = new THREE.Scene();
var vsNormalize = Potree.Shaders["normalize.vs"];
var fsNormalize = Potree.Shaders["normalize.fs"];
rtNormalize = new THREE.WebGLRenderTarget( 1024, 1024, {
minFilter: THREE.LinearFilter,
magFilter: THREE.NearestFilter,
format: THREE.RGBAFormat,
type: THREE.FloatType
} );
var uniformsNormalize = {
depthMap: { type: "t", value: rtDepth },
texture: { type: "t", value: rtNormalize }
};
var materialNormalize = new THREE.ShaderMaterial({
normalizationMaterial = new THREE.ShaderMaterial({
uniforms: uniformsNormalize,
vertexShader: vsNormalize,
fragmentShader: fsNormalize
vertexShader: Potree.Shaders["normalize.vs"],
fragmentShader: Potree.Shaders["normalize.fs"]
});
var quad = new THREE.Mesh( new THREE.PlaneBufferGeometry(2, 2, 0), materialNormalize);
quad.material.depthTest = true;
quad.material.depthWrite = true;
quad.material.transparent = true;
sceneNormalize.add(quad);
sceneNormalize.screenQuad = quad;
}
// resize
if(rtDepth){
if(rtDepth.width != elRenderArea.clientWidth || rtDepth.height != elRenderArea.clientHeight){
rtDepth.dispose();
rtNormalize.dispose();
rtDepth = new THREE.WebGLRenderTarget( 1024, 1024, {
minFilter: THREE.NearestFilter,
magFilter: THREE.NearestFilter,
format: THREE.RGBAFormat,
type: THREE.FloatType
} );
rtNormalize = new THREE.WebGLRenderTarget( 1024, 1024, {
minFilter: THREE.LinearFilter,
magFilter: THREE.NearestFilter,
format: THREE.RGBAFormat,
type: THREE.FloatType
} );
sceneNormalize.screenQuad.material.uniforms.depthMap.value = rtDepth;
sceneNormalize.screenQuad.material.uniforms.texture.value = rtNormalize;
var resize = function(width, height){
if(rtDepth.width == width && rtDepth.height == height){
return;
}
}
var width = elRenderArea.clientWidth;
var height = elRenderArea.clientHeight;
var aspect = width / height;
camera.aspect = aspect;
camera.updateProjectionMatrix();
renderer.setSize(width, height);
rtDepth.setSize(width, height);
rtNormalize.setSize(width, height);
renderer.clear();
//renderer.render(sceneBG, cameraBG);
// render skybox
if(showSkybox){
skybox.camera.rotation.copy(camera.rotation);
renderer.render(skybox.scene, skybox.camera);
}else{
renderer.render(sceneBG, cameraBG);
}
renderer.render(scene, camera);
if(pointcloud){
if(typeof pointcloud._hqsplats === "undefined"){
var hq = {
originalMaterial: pointcloud.material,
depthMaterial: new Potree.PointCloudMaterial(),
attributeMaterial: new Potree.PointCloudMaterial()
rtDepth.dispose();
rtNormalize.dispose();
camera.aspect = width / height;
camera.updateProjectionMatrix();
renderer.setSize(width, height);
rtDepth.setSize(width, height);
rtNormalize.setSize(width, height);
};
// render with splats
this.render = function(renderer){
var width = elRenderArea.clientWidth;
var height = elRenderArea.clientHeight;
initHQSPlats();
resize(width, height);
renderer.clear();
if(showSkybox){
skybox.camera.rotation.copy(camera.rotation);
renderer.render(skybox.scene, skybox.camera);
}else{
renderer.render(sceneBG, cameraBG);
}
renderer.render(scene, camera);
if(pointcloud){
depthMaterial.uniforms.octreeSize.value = pointcloud.pcoGeometry.boundingBox.size().x;
attributeMaterial.uniforms.octreeSize.value = pointcloud.pcoGeometry.boundingBox.size().x;
pointcloud.visiblePointsTarget = pointCountTarget * 1000 * 1000;
var originalMaterial = pointcloud.material;
{// DEPTH PASS
depthMaterial.size = pointSize;
depthMaterial.pointSizeType = pointSizeType;
depthMaterial.screenWidth = width;
depthMaterial.screenHeight = height;
depthMaterial.uniforms.visibleNodes.value = pointcloud.material.visibleNodesTexture;
depthMaterial.uniforms.octreeSize.value = pointcloud.pcoGeometry.boundingBox.size().x;
depthMaterial.fov = camera.fov * (Math.PI / 180);
depthMaterial.spacing = pointcloud.pcoGeometry.spacing;
depthMaterial.near = camera.near;
depthMaterial.far = camera.far;
depthMaterial.heightMin = heightMin;
depthMaterial.heightMax = heightMax;
depthMaterial.uniforms.visibleNodes.value = pointcloud.material.visibleNodesTexture;
depthMaterial.uniforms.octreeSize.value = pointcloud.pcoGeometry.boundingBox.size().x;
depthMaterial.bbSize = pointcloud.material.bbSize;
depthMaterial.treeType = pointcloud.material.treeType;
scenePointCloud.overrideMaterial = depthMaterial;
renderer.clearTarget( rtDepth, true, true, true );
renderer.render(scenePointCloud, camera, rtDepth);
scenePointCloud.overrideMaterial = null;
}
hq.depthMaterial.pointColorType = Potree.PointColorType.DEPTH;
hq.depthMaterial.pointShape = Potree.PointShape.CIRCLE;
hq.depthMaterial.interpolate = false;
hq.depthMaterial.weighted = false;
hq.depthMaterial.minSize = 2;
hq.depthMaterial.uniforms.octreeSize.value = pointcloud.pcoGeometry.boundingBox.size().x;
{// ATTRIBUTE PASS
attributeMaterial.size = pointSize;
attributeMaterial.pointSizeType = pointSizeType;
attributeMaterial.screenWidth = width;
attributeMaterial.screenHeight = height;
attributeMaterial.pointColorType = pointColorType;
attributeMaterial.depthMap = rtDepth;
attributeMaterial.uniforms.visibleNodes.value = pointcloud.material.visibleNodesTexture;
attributeMaterial.uniforms.octreeSize.value = pointcloud.pcoGeometry.boundingBox.size().x;
attributeMaterial.fov = camera.fov * (Math.PI / 180);
attributeMaterial.spacing = pointcloud.pcoGeometry.spacing;
attributeMaterial.near = camera.near;
attributeMaterial.far = camera.far;
attributeMaterial.heightMin = heightMin;
attributeMaterial.heightMax = heightMax;
attributeMaterial.intensityMin = pointcloud.material.intensityMin;
attributeMaterial.intensityMax = pointcloud.material.intensityMax;
attributeMaterial.setClipBoxes(pointcloud.material.clipBoxes);
attributeMaterial.clipMode = pointcloud.material.clipMode;
attributeMaterial.bbSize = pointcloud.material.bbSize;
attributeMaterial.treeType = pointcloud.material.treeType;
scenePointCloud.overrideMaterial = attributeMaterial;
renderer.clearTarget( rtNormalize, true, true, true );
renderer.render(scenePointCloud, camera, rtNormalize);
scenePointCloud.overrideMaterial = null;
}
hq.attributeMaterial.pointShape = Potree.PointShape.CIRCLE;
hq.attributeMaterial.interpolate = false;
hq.attributeMaterial.weighted = true;
hq.attributeMaterial.minSize = 2;
hq.attributeMaterial.uniforms.octreeSize.value = pointcloud.pcoGeometry.boundingBox.size().x;
{// NORMALIZATION PASS
normalizationMaterial.uniforms.depthMap.value = rtDepth;
normalizationMaterial.uniforms.texture.value = rtNormalize;
Potree.utils.screenPass.render(renderer, normalizationMaterial);
}
pointcloud._hqsplats = hq;
pointcloud.material = originalMaterial;
volumeTool.render();
renderer.clearDepth();
profileTool.render();
measuringTool.render();
transformationTool.render();
}
{// DEPTH PASS
var material = pointcloud._hqsplats.depthMaterial;
material.size = pointSize;
material.pointSizeType = pointSizeType;
material.screenWidth = width;
material.screenHeight = height;
material.uniforms.visibleNodes.value = pointcloud.material.visibleNodesTexture;
material.uniforms.octreeSize.value = pointcloud.pcoGeometry.boundingBox.size().x;
material.fov = camera.fov * (Math.PI / 180);
material.spacing = pointcloud.pcoGeometry.spacing;
material.near = camera.near;
material.far = camera.far;
pointcloud.material = material;
pointcloud.update(camera, renderer);
renderer.clearTarget( rtDepth, true, true, true );
renderer.clearTarget( rtNormalize, true, true, true );
renderer.render(scenePointCloud, camera, rtDepth);
}
{// ATTRIBUTE PASS
var material = pointcloud._hqsplats.attributeMaterial;
material.size = pointSize;
material.pointSizeType = pointSizeType;
material.screenWidth = width;
material.screenHeight = height;
material.pointColorType = pointColorType;
material.depthMap = rtDepth;
material.uniforms.visibleNodes.value = pointcloud.material.visibleNodesTexture;
material.uniforms.octreeSize.value = pointcloud.pcoGeometry.boundingBox.size().x;
material.fov = camera.fov * (Math.PI / 180);
material.spacing = pointcloud.pcoGeometry.spacing;
material.near = camera.near;
material.far = camera.far;
pointcloud.material = material;
pointcloud.update(camera, renderer);
renderer.render(scenePointCloud, camera, rtNormalize);
}
// NORMALIZATION PASS
renderer.render(sceneNormalize, cameraBG);
pointcloud.material = pointcloud._hqsplats.originalMaterial;
}
};
var edlRenderer = null;
var EDLRenderer = function(){
var edlMaterial = null;
var attributeMaterial = null;
volumeTool.render();
renderer.clearDepth();
profileTool.render();
measuringTool.render();
transformationTool.render();
//var depthTexture = null;
var rtColor = null;
var gl = renderer.context;
var initEDL = function(){
if(edlMaterial != null){
return;
}
//var depthTextureExt = gl.getExtension("WEBGL_depth_texture");
edlMaterial = new Potree.EyeDomeLightingMaterial();
attributeMaterial = new Potree.PointCloudMaterial();
attributeMaterial.pointShape = Potree.PointShape.CIRCLE;
attributeMaterial.interpolate = false;
attributeMaterial.weighted = false;
attributeMaterial.minSize = 2;
attributeMaterial.useLogarithmicDepthBuffer = false;
attributeMaterial.useEDL = true;
rtColor = new THREE.WebGLRenderTarget( 1024, 1024, {
minFilter: THREE.LinearFilter,
magFilter: THREE.NearestFilter,
format: THREE.RGBAFormat,
type: THREE.FloatType,
//type: THREE.UnsignedByteType,
//depthBuffer: false,
//stencilBuffer: false
} );
//depthTexture = new THREE.Texture();
//depthTexture.__webglInit = true;
//depthTexture.__webglTexture = gl.createTexture();;
//gl.bindTexture(gl.TEXTURE_2D, depthTexture.__webglTexture);
//gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
//gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
//gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
//gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
//gl.texImage2D(gl.TEXTURE_2D, 0, gl.DEPTH_COMPONENT, 1024, 1024, 0, gl.DEPTH_COMPONENT, gl.UNSIGNED_SHORT, null);
};
var resize = function(){
var width = elRenderArea.clientWidth;
var height = elRenderArea.clientHeight;
var aspect = width / height;
var needsResize = (rtColor.width != width || rtColor.height != height);
// disposal will be unnecessary once this fix made it into three.js master:
// https://github.com/mrdoob/three.js/pull/6355
if(needsResize){
rtColor.dispose();
}
camera.aspect = aspect;
camera.updateProjectionMatrix();
renderer.setSize(width, height);
rtColor.setSize(width, height);
//if(needsResize){
// renderer.setRenderTarget(rtColor);
// var framebuffer = rtColor.__webglFramebuffer;
// gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);
//
//
// gl.bindRenderbuffer( gl.RENDERBUFFER, rtColor.__webglRenderbuffer );
// gl.renderbufferStorage( gl.RENDERBUFFER, gl.DEPTH_COMPONENT16, rtColor.width, rtColor.height );
// gl.framebufferRenderbuffer( gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, null );
//
// gl.bindTexture(gl.TEXTURE_2D, depthTexture.__webglTexture);
// gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
// gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
// gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
// gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
// gl.texImage2D(gl.TEXTURE_2D, 0, gl.DEPTH_COMPONENT, width, height, 0, gl.DEPTH_COMPONENT, gl.UNSIGNED_INT, null);
//
// gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.TEXTURE_2D, depthTexture.__webglTexture, 0);
//
// renderer.setRenderTarget(null);
//}
}
}
this.render = function(){
initEDL();
resize();
renderer.clear();
if(showSkybox){
skybox.camera.rotation.copy(camera.rotation);
renderer.render(skybox.scene, skybox.camera);
}else{
renderer.render(sceneBG, cameraBG);
}
renderer.render(scene, camera);
if(pointcloud){
var width = elRenderArea.clientWidth;
var height = elRenderArea.clientHeight;
var octreeSize = pointcloud.pcoGeometry.boundingBox.size().x;
pointcloud.visiblePointsTarget = pointCountTarget * 1000 * 1000;
var originalMaterial = pointcloud.material;
{// COLOR & DEPTH PASS
attributeMaterial.size = pointSize;
attributeMaterial.pointSizeType = pointSizeType;
attributeMaterial.screenWidth = width;
attributeMaterial.screenHeight = height;
attributeMaterial.pointColorType = pointColorType;
attributeMaterial.uniforms.visibleNodes.value = pointcloud.material.visibleNodesTexture;
attributeMaterial.uniforms.octreeSize.value = octreeSize;
attributeMaterial.fov = camera.fov * (Math.PI / 180);
attributeMaterial.spacing = pointcloud.pcoGeometry.spacing;
attributeMaterial.near = camera.near;
attributeMaterial.far = camera.far;
attributeMaterial.heightMin = heightMin;
attributeMaterial.heightMax = heightMax;
attributeMaterial.intensityMin = pointcloud.material.intensityMin;
attributeMaterial.intensityMax = pointcloud.material.intensityMax;
attributeMaterial.setClipBoxes(pointcloud.material.clipBoxes);
attributeMaterial.clipMode = pointcloud.material.clipMode;
attributeMaterial.bbSize = pointcloud.material.bbSize;
attributeMaterial.treeType = pointcloud.material.treeType;
scenePointCloud.overrideMaterial = attributeMaterial;
renderer.clearTarget( rtColor, true, true, true );
renderer.render(scenePointCloud, camera, rtColor);
scenePointCloud.overrideMaterial = null;
}
{ // EDL OCCLUSION PASS
edlMaterial.uniforms.screenWidth.value = width;
edlMaterial.uniforms.screenHeight.value = height;
edlMaterial.uniforms.near.value = camera.near;
edlMaterial.uniforms.far.value = camera.far;
edlMaterial.uniforms.colorMap.value = rtColor;
edlMaterial.uniforms.expScale.value = camera.far;
//edlMaterial.uniforms.depthMap.value = depthTexture;
Potree.utils.screenPass.render(renderer, edlMaterial);
}
renderer.render(scene, camera);
profileTool.render();
volumeTool.render();
renderer.clearDepth();
measuringTool.render();
transformationTool.render();
}
}
};
//var toggleMessage = 0;
function loop() {
requestAnimationFrame(loop);
//var start = new Date().getTime();
update();
//var end = new Date().getTime();
//var duration = end - start;
//toggleMessage++;
//if(toggleMessage > 30){
// document.getElementById("lblMessage").innerHTML = "update: " + duration + "ms";
// toggleMessage = 0;
//}
if(quality === "Splats"){
renderHighQuality();
if(sceneProperties.useEDL){
if(!edlRenderer){
edlRenderer = new EDLRenderer();
}
edlRenderer.render(renderer);
}else if(quality === "Splats"){
if(!highQualityRenderer){
highQualityRenderer = new HighQualityRenderer();
}
highQualityRenderer.render(renderer);
}else{
render();
potreeRenderer.render();
}
};

View File

@ -9,6 +9,7 @@
<script src="../libs/three.js/build/three.js"></script>
<script src="../libs/other/stats.min.js"></script>
<script src="../libs/other/dat.gui.min.js"></script>
<script src="../libs/other/BinaryHeap.js"></script>
<script src="../build/js/potree.js"></script>
<script src="./js/ProgressBar.js"></script>
@ -21,6 +22,7 @@
<script src="../src/loader/POCLoader.js"></script>
<script src="../src/loader/BinaryLoader.js"></script>
<script src="../src/materials/PointCloudMaterial.js"></script>
<script src="../src/materials/EyeDomeLightingMaterial.js"></script>
<script src="../src/EarthControls.js"></script>
<script src="../src/OrbitControls.js"></script>
<script src="../src/FirstPersonControls.js"></script>
@ -73,17 +75,19 @@
<div id="renderArea"></div>
<script>
var sceneProperties = {
path: "../resources/pointclouds/lion_takanawa/cloud.js",
cameraPosition: [3.6, 4.367, 4],// other options: cameraPosition: [10,10,10],
cameraTarget: null, // other options: cameraTarget: [0,0,0],
sizeType: "Adaptive", // other options: "Fixed", "Attenuated"
quality: null, // other options: "Circles", "Interpolation", "Splats"
fov: 75, // other options: "Circles", "Interpolation", "Splats"
material: "RGB", // other options: "Height", "Intensity", "Classification"
pointLimit: 1, // max number of points in millions
navigation: "Orbit", // other options: "Earth", "Orbit", "Flight"
pointSize: 1.0
path: "../resources/pointclouds/lion_takanawa/cloud.js",
cameraPosition: null,
cameraTarget: null,
sizeType: "Adaptive", // options: "Fixed", "Attenuated", "Adaptive"
quality: "Interpolation", // options: "Squares", "Circles", "Interpolation", "Splats"
fov: 75, // field of view in degree
material: "RGB", // options: "RGB", "Height", "Intensity", "Classification"
pointLimit: 1, // max number of points in millions
navigation: "Orbit", // options: "Earth", "Orbit", "Flight"
pointSize: 1.2,
useEDL: false, // eye-dome-lighting, especially usefull for point clouds without normals
};
</script>
<script src="./js/viewer.js"></script>

View File

@ -9,6 +9,7 @@
<script src="../libs/three.js/build/three.js"></script>
<script src="../libs/other/stats.min.js"></script>
<script src="../libs/other/dat.gui.min.js"></script>
<script src="../libs/other/BinaryHeap.js"></script>
<script src="../build/js/potree.js"></script>
<script src="./js/ProgressBar.js"></script>
@ -21,6 +22,7 @@
<script src="../src/loader/POCLoader.js"></script>
<script src="../src/loader/BinaryLoader.js"></script>
<script src="../src/materials/PointCloudMaterial.js"></script>
<script src="../src/materials/EyeDomeLightingMaterial.js"></script>
<script src="../src/EarthControls.js"></script>
<script src="../src/OrbitControls.js"></script>
<script src="../src/FirstPersonControls.js"></script>
@ -73,17 +75,19 @@
<div id="renderArea"></div>
<script>
var sceneProperties = {
path: "../resources/pointclouds/lion_takanawa_las/cloud.js",
cameraPosition: [3.6, 4.367, 4],// other options: cameraPosition: [10,10,10],
cameraTarget: null, // other options: cameraTarget: [0,0,0],
sizeType: "Adaptive", // other options: "Fixed", "Attenuated"
quality: null, // other options: "Circles", "Interpolation", "Splats"
fov: 75, // other options: "Circles", "Interpolation", "Splats"
material: "RGB", // other options: "Height", "Intensity", "Classification"
pointLimit: 1, // max number of points in millions
navigation: "Orbit", // other options: "Earth", "Orbit", "Flight"
pointSize: 1.0
path: "../resources/pointclouds/lion_takanawa_las/cloud.js",
cameraPosition: null,
cameraTarget: null,
sizeType: "Adaptive", // options: "Fixed", "Attenuated", "Adaptive"
quality: "Interpolation", // options: "Squares", "Circles", "Interpolation", "Splats"
fov: 75, // field of view in degree
material: "RGB", // options: "RGB", "Height", "Intensity", "Classification"
pointLimit: 1, // max number of points in millions
navigation: "Orbit", // options: "Earth", "Orbit", "Flight"
pointSize: 1.2,
useEDL: false, // eye-dome-lighting, especially usefull for point clouds without normals
};
</script>
<script src="./js/viewer.js"></script>

View File

@ -9,6 +9,7 @@
<script src="../libs/three.js/build/three.js"></script>
<script src="../libs/other/stats.min.js"></script>
<script src="../libs/other/dat.gui.min.js"></script>
<script src="../libs/other/BinaryHeap.js"></script>
<script src="../build/js/potree.js"></script>
<script src="./js/ProgressBar.js"></script>
@ -21,6 +22,7 @@
<script src="../src/loader/POCLoader.js"></script>
<script src="../src/loader/BinaryLoader.js"></script>
<script src="../src/materials/PointCloudMaterial.js"></script>
<script src="../src/materials/EyeDomeLightingMaterial.js"></script>
<script src="../src/EarthControls.js"></script>
<script src="../src/OrbitControls.js"></script>
<script src="../src/FirstPersonControls.js"></script>
@ -73,17 +75,19 @@
<div id="renderArea"></div>
<script>
var sceneProperties = {
path: "../resources/pointclouds/lion_takanawa_laz/cloud.js",
cameraPosition: [3.6, 4.367, 4],// other options: cameraPosition: [10,10,10],
cameraTarget: null, // other options: cameraTarget: [0,0,0],
sizeType: "Adaptive", // other options: "Fixed", "Attenuated"
quality: null, // other options: "Circles", "Interpolation", "Splats"
fov: 75, // other options: "Circles", "Interpolation", "Splats"
material: "RGB", // other options: "Height", "Intensity", "Classification"
pointLimit: 1, // max number of points in millions
navigation: "Orbit", // other options: "Earth", "Orbit", "Flight"
pointSize: 1.0
path: "../resources/pointclouds/lion_takanawa_laz/cloud.js",
cameraPosition: null,
cameraTarget: null,
sizeType: "Adaptive", // options: "Fixed", "Attenuated", "Adaptive"
quality: "Interpolation", // options: "Squares", "Circles", "Interpolation", "Splats"
fov: 75, // field of view in degree
material: "RGB", // options: "RGB", "Height", "Intensity", "Classification"
pointLimit: 1, // max number of points in millions
navigation: "Orbit", // options: "Earth", "Orbit", "Flight"
pointSize: 1.2,
useEDL: false, // eye-dome-lighting, especially usefull for point clouds without normals
};
</script>
<script src="./js/viewer.js"></script>

104
examples/measurements.html Normal file
View File

@ -0,0 +1,104 @@
<html>
<head>
<meta charset="utf-8"/>
<title>Potree Viewer</title>
<link rel="stylesheet" type="text/css" href="css/potree.css">
</head>
<body>
<script src="../libs/three.js/build/three.js"></script>
<script src="../libs/other/stats.min.js"></script>
<script src="../libs/other/dat.gui.min.js"></script>
<script src="../libs/other/BinaryHeap.js"></script>
<script src="../build/js/potree.js"></script>
<script src="./js/ProgressBar.js"></script>
<!-- INCLUDE ADDITIONAL DEPENDENCIES HERE -->
<!-- INCLUDE SETTINGS HERE -->
<!--<script src="../libs/plasio/js/laslaz.js"></script>
<script src="../libs/plasio/vendor/bluebird.js"></script>
<script src="../build/js/laslaz.js"></script>-->
<!-- HEADING -->
<div class="info" style="position: absolute; left: 300px; right: 300px; top: 10px; text-align: center;">
<a href="http://potree.org" target="_blank">potree.org</a><br>
Point cloud courtesy of <a href="http://www.sigeom.ch/" target="_blank">sigeom sa</a><br>
</div>
<!-- INFOS / STATS -->
<div id="lblNumVisibleNodes" class="info" style="position: absolute; left: 10px; top: 80px; width: 400px; color:white"></div>
<div id="lblNumVisiblePoints" class="info" style="position: absolute; left: 10px; top: 100px; width: 400px; color:white"></div>
<div id="lblMessage" class="info" style="position: absolute; left: 10px; bottom: 0px; width: 400px; color:white"></div>
<div id="renderArea"></div>
<!-- TOOLS -->
<div id="tools" style="position: fixed; width: 400px; bottom: 10px; right: 10px">
<img src="../resources/icons/earth_controls_1.png" onclick="useEarthControls()" title="Earth Controls"/>
<img src="../resources/icons/fps_controls.png" onclick="useFPSControls()" title="Fly Camera"/>
<img src="../resources/icons/orbit_controls.png" onclick="useOrbitControls()" title="Orbit Controls"/>
<img src="../resources/icons/focus.png" onclick="camera.zoomTo(pointcloud)" title="focus on pointcloud"/>
<img src="../resources/icons/flip_y_z.png" onclick="flipYZ()" title="flip y and z coordinates"/>
<img src="../resources/icons/angle.png" onclick="measuringTool.startInsertion({showDistances: false, showAngles: true, showArea: false, closed: true, maxMarkers: 3})" title="angle measurements"/>
<img src="../resources/icons/distance.png" onclick="measuringTool.startInsertion({showDistances: true, showArea: false, closed: false})" title="distance measurements"/>
<img src="../resources/icons/area.png" onclick="measuringTool.startInsertion({showDistances: true, showArea: true, closed: true})" title="area measurements"/>
<img src="../resources/icons/volume.png" onclick="volumeTool.startInsertion()" title="volume measurements"/>
<img src="../resources/icons/profile.png" onclick="profileTool.startInsertion({width: pointcloud.boundingSphere.radius / 100})" title="height profiles"/>
<img src="../resources/icons/clip_volume.png" onclick="volumeTool.startInsertion({clip: true})" title="clipping volumes"/>
</div>
<script>
var sceneProperties = {
path: "http://5.9.65.151/mschuetz/potree/resources/pointclouds/pix4d/matterhorn/cloud.js",
path: "http://5.9.65.151/mschuetz/potree/test/cloud.js",
path: "../resources/pointclouds/lion_takanawa/cloud.js",
path: "http://localhost/temp/test/cloud.js",
path: "../resources/pointclouds/vol_total/cloud.js",
cameraPosition: null,
cameraTarget: null,
sizeType: "Fixed", // options: "Fixed", "Attenuated", "Adaptive"
quality: "Squares", // options: "Squares", "Circles", "Interpolation", "Splats"
fov: 75, // field of view in degree
material: "RGB", // options: "RGB", "Height", "Intensity", "Classification"
pointLimit: 1, // max number of points in millions
navigation: "Orbit", // options: "Earth", "Orbit", "Flight"
pointSize: 2,
useEDL: false, // eye-dome-lighting, especially usefull for point clouds without normals
};
</script>
<script src="./js/viewer.js"></script>
<script>
var distanceMeasurement = new Potree.Measure();
distanceMeasurement.addMarker(new THREE.Vector3(-294, 59, 95));
distanceMeasurement.addMarker(new THREE.Vector3(-179, 55, -1));
distanceMeasurement.addMarker(new THREE.Vector3(-69,33,-39));
distanceMeasurement.showDistances = true;
distanceMeasurement.showArea = false;
distanceMeasurement.showAngles = false;
distanceMeasurement.closed = false;
measuringTool.addMeasurement(distanceMeasurement);
var areaMeasurement = new Potree.Measure();
areaMeasurement.addMarker(new THREE.Vector3(108.04, 6.46, -36.70));
areaMeasurement.addMarker(new THREE.Vector3(58.27, 17.01, 72.32 ));
areaMeasurement.addMarker(new THREE.Vector3(67.35, 18.50, 95.41 ));
areaMeasurement.addMarker(new THREE.Vector3(92.06, 20.68, 97.29 ));
areaMeasurement.addMarker(new THREE.Vector3(186.39, 17.83, 8.16 ));
areaMeasurement.showDistances = true;
areaMeasurement.showArea = true;
areaMeasurement.showAngles = false;
areaMeasurement.closed = true;
measuringTool.addMeasurement(areaMeasurement);
</script>
</body>
</html>

View File

@ -29,6 +29,7 @@
</style>
<script src="../libs/other/BinaryHeap.js"></script>
<script src="../libs/three.js/build/three.js"></script>
<script src="../libs/other/OrbitControls.js"></script>
<script src="../build/js/potree.js"></script>
@ -99,7 +100,7 @@
});
controls = new THREE.OrbitControls(camera, renderer.domElement);
controls = new Potree.OrbitControls(camera, renderer.domElement);
}
function update(){

View File

@ -111,6 +111,7 @@ The updateMapExtent() shows how this can be used to visualize the boundaries in
<script src="../libs/three.js/build/three.js"></script>
<script src="../libs/other/dat.gui.min.js"></script>
<script src="../libs/proj4/proj4.js"></script>
<script src="../libs/other/BinaryHeap.js"></script>
<script src="../build/js/potree.js"></script>
<script src="js/ProgressBar.js"></script>

View File

@ -1,121 +0,0 @@
<html>
<head>
<script src="../libs/three.js/build/three.js"></script>
<script src="../libs/other/OrbitControls.js"></script>
<script src="../build/js/potree.min.js"></script>
</head>
<body style="margin: 0px; padding: 0px;">
<script type="text/javascript">
var renderer;
var camera;
var scene;
var pickLocation;
var mouse = { x: 1, y: 1 };
var raycaster;
function generatePointcloud(){
var geometry = new THREE.BufferGeometry();
var width = 200;
var length = 200;
var numPoints = width*length;
var positions = new Float32Array(numPoints*3);
var colors = new Float32Array(numPoints*3);
var color = new THREE.Color();
var k = 0;
for(var i = 0; i < width; i++){
for(var j = 0; j < length; j++){
var u = i/width;
var v = j/length;
var x = 10*u - 5;
var y = (Math.cos(u*Math.PI*8) + Math.sin(v*Math.PI*8))/2;
var z = 10*v - 5;
positions[3*k] = x;
positions[3*k+1] = y;
positions[3*k+2] = z;
var intensity = y+1;
color.setRGB(u*intensity, v*intensity, 0);
colors[3*k] = color.r;
colors[3*k+1] = color.g;
colors[3*k+2] = color.b;
k++;
}
}
geometry.addAttribute('position', new THREE.BufferAttribute(positions, 3));
geometry.addAttribute('color', new THREE.BufferAttribute(colors, 3));
var material = new THREE.PointCloudMaterial({ size: 0.01, vertexColors: true });
var pointcloud = new THREE.PointCloud(geometry, material);
return pointcloud;
}
function init() {
scene = new THREE.Scene();
camera = new THREE.PerspectiveCamera(75, window.innerWidth/window.innerHeight, 0.1, 1000);
raycaster = new THREE.Raycaster();
renderer = new THREE.WebGLRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);
pointcloud = generatePointcloud();
scene.add(pointcloud);
var sphereGeometry = new THREE.SphereGeometry(0.1, 32, 32);
var sphereMaterial = new THREE.MeshBasicMaterial({color: 0xff0000, shading: THREE.FlatShading});
pickLocation = new THREE.Mesh(sphereGeometry, sphereMaterial);
scene.add(pickLocation);
// controls
camera.position.set(5,5,2);
controls = new THREE.OrbitControls(camera);
controls.target.set( 0, 0, 0 );
camera.lookAt(new THREE.Vector3(0,0,0));
document.addEventListener( 'mousemove', onDocumentMouseMove, false );
}
function onDocumentMouseMove( event ) {
event.preventDefault();
mouse.x = ( event.clientX / window.innerWidth ) * 2 - 1;
mouse.y = - ( event.clientY / window.innerHeight ) * 2 + 1;
}
function render() {
requestAnimationFrame(render);
camera.updateMatrixWorld(true);
vector = new THREE.Vector3( mouse.x, mouse.y, 0.5 );
vector.unproject(camera);
raycaster.params = {"PointCloud" : {threshold: 0.1}};
raycaster.ray.set( camera.position, vector.sub( camera.position ).normalize() );
var intersects = raycaster.intersectObject(pointcloud);
if(intersects.length > 0){
var I = intersects[0];
pickLocation.position.copy(I.point);
}
renderer.render(scene, camera);
};
init();
render();
</script>
</body>
</html>

View File

@ -2,6 +2,7 @@
<head>
<meta charset="utf-8"/>
<title>Potree Viewer</title>
<!--<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">-->
<link rel="stylesheet" type="text/css" href="css/potree.css">
</head>
<body>
@ -9,18 +10,20 @@
<script src="../libs/three.js/build/three.js"></script>
<script src="../libs/other/stats.min.js"></script>
<script src="../libs/other/dat.gui.min.js"></script>
<script src="../libs/other/BinaryHeap.js"></script>
<script src="../build/js/potree.js"></script>
<script src="./js/ProgressBar.js"></script>
<!-- uncomment this to debug changes to the individual js files -->
<!--
<script src="../src/PointCloudOctree.js"></script>
<script src="../src/PointCloudOctreeGeometry.js"></script>
<script src="../src/loader/POCLoader.js"></script>
<script src="../src/loader/BinaryLoader.js"></script>
<script src="../src/loader/LasLazLoader.js"></script>
<script src="../src/materials/PointCloudMaterial.js"></script>
<script src="../src/materials/EyeDomeLightingMaterial.js"></script>
<script src="../src/EarthControls.js"></script>
<script src="../src/OrbitControls.js"></script>
<script src="../src/FirstPersonControls.js"></script>
@ -34,9 +37,6 @@
<script src="../src/Features.js"></script>
<script src="../src/arena4d/PointCloudArena4D.js"></script>
<script src="../src/arena4d/PointCloudArena4DGeometry.js"></script>
-->
<!-- INCLUDE ADDITIONAL DEPENDENCIES HERE -->
<!-- INCLUDE SETTINGS HERE -->
@ -74,17 +74,25 @@
<div id="renderArea"></div>
<script>
var sceneProperties = {
path: "http://5.9.65.151/mschuetz/potree/resources/pointclouds/pix4d/matterhorn/cloud.js",
path: "../resources/pointclouds/lion_takanawa/cloud.js",
path: "http://5.9.65.151/mschuetz/potree/resources/pointclouds/vermessung_zh_ch/zuerich/cloud.js",
path: "http://localhost/dev/pointclouds/opentopography/CA13_SAN_SIM/selection_converted/cloud.js",
path: "http://5.9.65.151/mschuetz/potree/test/cloud.js",
path: "http://localhost/temp/test/cloud.js",
path: "../resources/pointclouds/vol_total/cloud.js",
cameraPosition: null, // options: cameraPosition: [10,10,10],
cameraTarget: null, // options: cameraTarget: [0,0,0],
cameraPosition: null,
cameraTarget: null,
sizeType: "Adaptive", // options: "Fixed", "Attenuated", "Adaptive"
quality: null, // options: "Squares", "Circles", "Interpolation", "Splats"
quality: "Squares", // options: "Squares", "Circles", "Interpolation", "Splats"
fov: 75, // field of view in degree
material: "RGB", // options: "RGB", "Height", "Intensity", "Classification"
pointLimit: 1, // max number of points in millions
navigation: "Orbit", // options: "Earth", "Orbit", "Flight"
pointSize: 1.0
pointSize: 1,
useEDL: false, // eye-dome-lighting, especially usefull for point clouds without normals
};
</script>
<script src="./js/viewer.js"></script>

View File

@ -25,6 +25,8 @@ var paths = {
"src/loader/BinaryLoader.js",
"src/loader/LasLazLoader.js",
"src/materials/PointCloudMaterial.js",
"src/materials/EyeDomeLightingMaterial.js",
"src/materials/BlurMaterial.js",
"src/FirstPersonControls.js",
"src/OrbitControls.js",
"src/EarthControls.js",
@ -67,7 +69,11 @@ var shaders = [
"src/materials/shaders/pointcloud.vs",
"src/materials/shaders/pointcloud.fs",
"src/materials/shaders/normalize.vs",
"src/materials/shaders/normalize.fs"
"src/materials/shaders/normalize.fs",
"src/materials/shaders/edl.vs",
"src/materials/shaders/edl.fs",
"src/materials/shaders/blur.vs",
"src/materials/shaders/blur.fs"
];

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<TileMap version="1.0.0" tilemapservice="http://tms.osgeo.org/1.0.0">
<Title>NE2_HR_LC_SR_W_DR_recolored.tif</Title>
<Abstract></Abstract>
<SRS>EPSG:4326</SRS>
<BoundingBox minx="-90.00000000000000" miny="-180.00000000000000" maxx="90.00000000000000" maxy="180.00000000000000"/>
<Origin x="-90.00000000000000" y="-180.00000000000000"/>
<TileFormat width="256" height="256" mime-type="image/jpg" extension="jpg"/>
<TileSets profile="geodetic">
<TileSet href="0" units-per-pixel="0.70312500000000" order="0"/>
<TileSet href="1" units-per-pixel="0.35156250000000" order="1"/>
<TileSet href="2" units-per-pixel="0.17578125000000" order="2"/>
</TileSets>
</TileMap>

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 KiB

Some files were not shown because too many files have changed in this diff Show More