Skip to content

Commit

Permalink
Merge pull request #173 from potree/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
m-schuetz committed Sep 13, 2015
2 parents 7f2ec62 + 34b4a0c commit 7015199
Show file tree
Hide file tree
Showing 333 changed files with 10,897 additions and 3,788 deletions.
20 changes: 9 additions & 11 deletions README.md
Expand Up @@ -4,29 +4,30 @@
* [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/)

Newest information and work in progress is usually available on [twitter](https://twitter.com/m_schuetz)

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

Expand All @@ -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.
2 changes: 1 addition & 1 deletion build/js/laslaz.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion build/js/laslaz.min.js

Large diffs are not rendered by default.

1,448 changes: 808 additions & 640 deletions build/js/potree.js

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions build/js/potree.min.js

Large diffs are not rendered by default.

237 changes: 219 additions & 18 deletions build/shaders/shaders.js
Expand Up @@ -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;",
"",
Expand Down Expand Up @@ -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;",
Expand Down Expand Up @@ -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",
Expand All @@ -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);",
Expand All @@ -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;",
Expand Down Expand Up @@ -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",
"",
Expand Down Expand Up @@ -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;",
Expand All @@ -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;",
Expand All @@ -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",
Expand Down Expand Up @@ -576,6 +615,11 @@ Potree.Shaders["pointcloud.fs"] = [
"",
" #endif",
" ",
" ",
" #if defined(use_edl)",
" gl_FragColor.a = vLogDepth;",
" #endif",
" ",
"}",
"",
"",
Expand Down Expand Up @@ -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");

2 changes: 1 addition & 1 deletion build/workers/BinaryDecoderWorker.js

Large diffs are not rendered by default.

0 comments on commit 7015199

Please sign in to comment.