polishing composite material and stuff

This commit is contained in:
mschuetz 2016-10-05 15:22:23 +02:00
parent 934edc9988
commit 877d056ddd
13 changed files with 16295 additions and 655 deletions

File diff suppressed because one or more lines are too long

View File

@ -58,7 +58,8 @@
height: 100%;
overflow-y: auto;
font-size: 85%;
overflow: hidden;
border-right: 1px solid black;
}
.potree_sidebar_brand{
@ -227,6 +228,15 @@ body{
flex-direction: row
}
.pv-menu-list{
list-style-type: none;
padding: 0;
}
.pv-menu-list > *{
margin: 8px 20px;
}
.pv-menu-list > li > .ui-slider{
background-color: #7A8184 !important;
@ -234,7 +244,7 @@ body{
border: 1px solid black;
}
.panel-body > li > .ui-slider{
.pv-menu-list > div > li > .ui-slider{
background-color: #7A8184 !important;
background: none;
border: 1px solid black;
@ -252,16 +262,28 @@ body{
width: 100% !important;
}
.pv-menu-list .ui-selectmenu-button span.ui-selectmenu-text{
line-height: 0.8em;
}
.panel-body > li > .ui-slider{
background-color: #7A8184 !important;
background: none;
border: 1px solid black;
}
.panel-body > div > li > .ui-slider{
background-color: #7A8184 !important;
background: none;
border: 1px solid black;
}
.pv-select-label{
margin: 1px;
font-size: 90%;
font-weight: 100;
}
.pv-menu-list .ui-selectmenu-button span.ui-selectmenu-text{
line-height: 0.8em;
}
.button-icon:hover{
background-color: #09181C;
}
@ -297,15 +319,6 @@ body{
.accordion > div{
background: none !important;
}
.pv-menu-list{
list-style-type: none;
padding: 0;
}
.pv-menu-list > li{
margin: 8px 20px;
}
#measurement_details .pv-menu-list > li{
margin: 20px 10px;
@ -391,6 +404,42 @@ body{
.divider {
display: block;
text-align: center;
overflow: hidden;
white-space: nowrap;
font-weight: bold;
font-size: 90%;
letter-spacing: 1px;
margin-left: -20px;
margin-right: -20px;
}
.divider > span {
position: relative;
display: inline-block;
}
.divider > span:before,
.divider > span:after {
content: "";
position: absolute;
top: 50%;
width: 9999px;
height: 1px;
background: #b2b2b2;
}
.divider > span:before {
right: 100%;
margin-right: 5px;
}
.divider > span:after {
left: 100%;
margin-left: 5px;
}

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,6 +1,8 @@
<div class="navmenu navmenu-default navmenu-fixed-left unselectable" style="min-height: 100%; height: 100%; border: 1px solid red">
<div id="sidebar_root"
class="perfect_scrollbar navmenu navmenu-default navmenu-fixed-left unselectable"
style="position: absolute; min-height: 100%; height: 100%; width: calc(100% - 1px); border-right: 1px solid black !important; overflow: hidden">
<span class="potree_sidebar_brand" style="display: flex; flex-direction: row">
<a href="http://potree.org" target="_blank">potree.org</a>
<span style="margin: 0px 3px; color: #9AA1A4"> - </span>
@ -15,7 +17,7 @@
<a href="javascript:viewer.setLanguage('fr');">FR</a> -
<a href="javascript:viewer.setLanguage('de');">DE</a>
</div>
<div>
<div id="accordion" class="accordion">
<h3><span data-i18n="tb.rendering_opt"></span></h3>
<div>
@ -46,13 +48,16 @@
<li><label class="menu-item"><input type="checkbox" onClick="viewer.setShowSkybox(this.checked)"/><span data-i18n="appearance.skybox"></span</label></li>
<li class="pv-divider"></li>
<li class="pv-menu-list-header">Eye-Dome-Lighting</li>
<li><label><input type="checkbox" id="chkEDLEnabled" onClick="viewer.setEDLEnabled(this.checked)"/><span data-i18n="appearance.edl_enable"></span></label></li>
<li><span data-i18n="appearance.edl_radius"></span>:<span id="lblEDLRadius"></span><div id="sldEDLRadius"></div></li>
<li><span data-i18n="appearance.edl_strength"></span>:<span id="lblEDLStrength"></span><div id="sldEDLStrength"></div></li>
<div>
<div class="divider">
<span>Eye-Dome-Lighting</span>
</div>
<li><label><input type="checkbox" id="chkEDLEnabled" onClick="viewer.setEDLEnabled(this.checked)"/><span data-i18n="appearance.edl_enable"></span></label></li>
<li><span data-i18n="appearance.edl_radius"></span>:<span id="lblEDLRadius"></span><div id="sldEDLRadius"></div></li>
<li><span data-i18n="appearance.edl_strength"></span>:<span id="lblEDLStrength"></span><div id="sldEDLStrength"></div></li>
</div>
</ul>
</div>
@ -78,12 +83,62 @@
<div>
<ul class="pv-menu-list">
<li>
<label for="optMaterial" class="pv-select-label"></label><br>
<label for="optMaterial" class="pv-select-label">Attributes:</label><br>
<select id="optMaterial" name="optMaterial">
</select>
</li>
<li><span data-i18n="appearance.elevation_range"></span>: <span id="lblHeightRange"></span> <div id="sldHeightRange"></div> </li>
<div id="materials.composite_weight_container">
<div class="divider">
<span>Attribute Weights</span>
</div>
<li>RGB: <span id="lblWeightRGB"></span> <div id="sldWeightRGB"></div> </li>
<li>Intensity: <span id="lblWeightIntensity"></span> <div id="sldWeightIntensity"></div> </li>
<li>Elevation: <span id="lblWeightElevation"></span> <div id="sldWeightElevation"></div> </li>
<li>Classification: <span id="lblWeightClassification"></span> <div id="sldWeightClassification"></div> </li>
<li>Return Number: <span id="lblWeightReturnNumber"></span> <div id="sldWeightReturnNumber"></div> </li>
<li>Source ID: <span id="lblWeightSourceID"></span> <div id="sldWeightSourceID"></div> </li>
</div>
<div id="materials.rgb_container">
<div class="divider">
<span>RGB</span>
</div>
<li>Gamma: <span id="lblRGBGamma"></span> <div id="sldRGBGamma"></div> </li>
<li>Brightness: <span id="lblRGBBrightness"></span> <div id="sldRGBBrightness"></div> </li>
<li>Contrast: <span id="lblRGBContrast"></span> <div id="sldRGBContrast"></div> </li>
</div>
<div id="materials.elevation_container">
<div class="divider">
<span>Elevation</span>
</div>
<li><span data-i18n="appearance.elevation_range"></span>: <span id="lblHeightRange"></span> <div id="sldHeightRange"></div> </li>
</div>
<div id="materials.transition_container">
<div class="divider">
<span>Transition</span>
</div>
<li>transition: <span id="lblTransition"></span> <div id="sldTransition"></div> </li>
</div>
<div id="materials.intensity_container">
<div class="divider">
<span>Intensity</span>
</div>
<li>Range: <span id="lblIntensityRange"></span> <div id="sldIntensityRange"></div> </li>
<li>Gamma: <span id="lblIntensityGamma"></span> <div id="sldIntensityGamma"></div> </li>
<li>Brightness: <span id="lblIntensityBrightness"></span> <div id="sldIntensityBrightness"></div> </li>
<li>Contrast: <span id="lblIntensityContrast"></span> <div id="sldIntensityContrast"></div> </li>
</div>
</ul>
<!--<ul id="materialList" class="pv-menu-list"></ul>-->
@ -174,7 +229,7 @@
</div>
-->
</div>
</div>
</div>
@ -270,20 +325,140 @@ function initMaterials(){
viewer.setHeightRange(local.min, local.max);
}
});
$( "#sldTransition" ).slider({
value: viewer.getMaterialTransition(),
min: 0,
max: 1,
step: 0.01,
slide: function( event, ui ) {viewer.setMaterialTransition(ui.value);}
});
$( "#sldIntensityRange" ).slider({
range: true,
min: 0,
max: 1,
values: [0, 1],
step: 0.01,
slide: function( event, ui ) {
let min = (ui.values[0] == 0) ? 0 : parseInt(Math.pow(2, 16 * ui.values[0]));
let max = parseInt(Math.pow(2, 16 * ui.values[1]));
viewer.setIntensityRange(min, max);
}
});
$( "#sldIntensityGamma" ).slider({
value: viewer.getIntensityGamma(),
min: 0,
max: 4,
step: 0.01,
slide: function( event, ui ) {viewer.setIntensityGamma(ui.value);}
});
$( "#sldIntensityContrast" ).slider({
value: viewer.getIntensityContrast(),
min: -1,
max: 1,
step: 0.01,
slide: function( event, ui ) {viewer.setIntensityContrast(ui.value);}
});
$( "#sldIntensityBrightness" ).slider({
value: viewer.getIntensityBrightness(),
min: -1,
max: 1,
step: 0.01,
slide: function( event, ui ) {viewer.setIntensityBrightness(ui.value);}
});
$( "#sldRGBGamma" ).slider({
value: viewer.getRGBGamma(),
min: 0,
max: 4,
step: 0.01,
slide: function( event, ui ) {viewer.setRGBGamma(ui.value);}
});
$( "#sldRGBContrast" ).slider({
value: viewer.getRGBContrast(),
min: -1,
max: 1,
step: 0.01,
slide: function( event, ui ) {viewer.setRGBContrast(ui.value);}
});
$( "#sldRGBBrightness" ).slider({
value: viewer.getRGBBrightness(),
min: -1,
max: 1,
step: 0.01,
slide: function( event, ui ) {viewer.setRGBBrightness(ui.value);}
});
$( "#sldWeightRGB" ).slider({
value: viewer.getWeightRGB(),
min: 0,
max: 1,
step: 0.01,
slide: function( event, ui ) {viewer.setWeightRGB(ui.value);}
});
$( "#sldWeightIntensity" ).slider({
value: viewer.getWeightIntensity(),
min: 0,
max: 1,
step: 0.01,
slide: function( event, ui ) {viewer.setWeightIntensity(ui.value);}
});
$( "#sldWeightElevation" ).slider({
value: viewer.getWeightElevation(),
min: 0,
max: 1,
step: 0.01,
slide: function( event, ui ) {viewer.setWeightElevation(ui.value);}
});
$( "#sldWeightClassification" ).slider({
value: viewer.getWeightClassification(),
min: 0,
max: 1,
step: 0.01,
slide: function( event, ui ) {viewer.setWeightClassification(ui.value);}
});
$( "#sldWeightReturnNumber" ).slider({
value: viewer.getWeightReturnNumber(),
min: 0,
max: 1,
step: 0.01,
slide: function( event, ui ) {viewer.setWeightReturnNumber(ui.value);}
});
$( "#sldWeightSourceID" ).slider({
value: viewer.getWeightSourceID(),
min: 0,
max: 1,
step: 0.01,
slide: function( event, ui ) {viewer.setWeightSourceID(ui.value);}
});
var updateHeightRange = function(){
var box = viewer.getBoundingBox();
var geoMin = viewer.toGeo(box.min).z;
var geoMax = viewer.toGeo(box.max).z;
let box = viewer.getBoundingBox();
let geoMin = viewer.toGeo(box.min).z;
let geoMax = viewer.toGeo(box.max).z;
let width = geoMax - geoMin;
geoMin = geoMin - 0.2 * width;
geoMax = geoMax + 0.2 * width;
var hr = viewer.getHeightRange();
var hrGeo = {
let hr = viewer.getHeightRange();
let hrGeo = {
min: viewer.toGeo(new THREE.Vector3(0, hr.min, 0)).z,
max: viewer.toGeo(new THREE.Vector3(0, hr.max, 0)).z,
};
var vMin = hr.min ? hrGeo.min : geoMin;
var vMax = hr.max ? hrGeo.max : geoMax;
let vMin = hr.min ? hrGeo.min : geoMin;
let vMax = hr.max ? hrGeo.max : geoMax;
$( '#lblHeightRange')[0].innerHTML = hrGeo.min.toFixed(2) + " to " + hrGeo.max.toFixed(2);
$( "#sldHeightRange" ).slider({
@ -293,27 +468,79 @@ function initMaterials(){
});
};
viewer.addEventListener("height_range_changed", function(event){
updateHeightRange();
var hr = viewer.getHeightRange();
var hrGeo = {
min: viewer.toGeo(new THREE.Vector3(0, hr.min, 0)).z,
max: viewer.toGeo(new THREE.Vector3(0, hr.max, 0)).z,
};
let updateIntensityRange = function(){
let range = viewer.getIntensityRange();
let min = Math.log2(range[0]) / 16;
let max = Math.log2(range[1]) / 16;
$( '#lblHeightRange')[0].innerHTML = hrGeo.min.toFixed(2) + " to " + hrGeo.max.toFixed(2);
$( "#sldHeightRange" ).slider({values: [hrGeo.min, hrGeo.max]});
$('#lblIntensityRange')[0].innerHTML =
parseInt(viewer.getIntensityRange()[0]) + " to " +
parseInt(viewer.getIntensityRange()[1]);
$( "#sldIntensityRange" ).slider({
values: [min, max]
});
};
viewer.addEventListener("height_range_changed", updateHeightRange);
viewer.addEventListener("intensity_range_changed", updateIntensityRange);
viewer.addEventListener("intensity_gamma_changed", function(event){
let gamma = viewer.getIntensityGamma();
$('#lblIntensityGamma')[0].innerHTML = gamma.toFixed(2);
$("#sldIntensityGamma").slider({value: gamma});
});
viewer.addEventListener("intensity_contrast_changed", function(event){
let contrast = viewer.getIntensityContrast();
$('#lblIntensityContrast')[0].innerHTML = contrast.toFixed(2);
$("#sldIntensityContrast").slider({value: contrast});
});
viewer.addEventListener("intensity_brightness_changed", function(event){
let brightness = viewer.getIntensityBrightness();
$('#lblIntensityBrightness')[0].innerHTML = brightness.toFixed(2);
$("#sldIntensityBrightness").slider({value: brightness});
});
viewer.addEventListener("rgb_gamma_changed", function(event){
let gamma = viewer.getRGBGamma();
$('#lblRGBGamma')[0].innerHTML = gamma.toFixed(2);
$("#sldRGBGamma").slider({value: gamma});
});
viewer.addEventListener("rgb_contrast_changed", function(event){
let contrast = viewer.getRGBContrast();
$('#lblRGBContrast')[0].innerHTML = contrast.toFixed(2);
$("#sldRGBContrast").slider({value: contrast});
});
viewer.addEventListener("rgb_brightness_changed", function(event){
let brightness = viewer.getRGBBrightness();
$('#lblRGBBrightness')[0].innerHTML = brightness.toFixed(2);
$("#sldRGBBrightness").slider({value: brightness});
});
viewer.addEventListener("pointcloud_loaded", updateHeightRange);
updateHeightRange();
updateIntensityRange();
$('#lblIntensityGamma')[0].innerHTML = viewer.getIntensityGamma().toFixed(2);
$('#lblIntensityContrast')[0].innerHTML = viewer.getIntensityContrast().toFixed(2);
$('#lblIntensityBrightness')[0].innerHTML = viewer.getIntensityBrightness().toFixed(2);
//var hr = viewer.getHeightRange();
//$('#lblHeightRange')[0].innerHTML = hr.min.toFixed(2) + " to " + hr.max.toFixed(2);
$('#lblRGBGamma')[0].innerHTML = viewer.getRGBGamma().toFixed(2);
$('#lblRGBContrast')[0].innerHTML = viewer.getRGBContrast().toFixed(2);
$('#lblRGBBrightness')[0].innerHTML = viewer.getRGBBrightness().toFixed(2);
var options = [
"RGB",
"RGB and Elevation",
"Color",
"Elevation",
"Intensity",
@ -322,7 +549,8 @@ function initMaterials(){
"Return Number",
"Source",
"Phong",
"Level of Detail"
"Level of Detail",
"Composite",
];
var elMaterialList = document.getElementById("optMaterial");
@ -336,12 +564,56 @@ function initMaterials(){
elMaterialList.appendChild(elOption);
}
$("#optMaterial").val(viewer.getMaterialName()).selectmenu("refresh")
$("#optMaterial").selectmenu({
change: function(event, ui){
viewer.setMaterial(ui.item.value);
let updateMaterialPanel = function(event, ui){
//viewer.setMaterial(ui.item.value);
let selectedValue = $("#optMaterial").selectmenu().val();
viewer.setMaterial(selectedValue);
let blockWeights = $("#materials\\.composite_weight_container");
let blockElevation = $("#materials\\.elevation_container");
let blockRGB = $("#materials\\.rgb_container");
let blockIntensity = $("#materials\\.intensity_container");
let blockTransition = $("#materials\\.transition_container");
blockIntensity.css("display", "none");
blockElevation.css("display", "none");
blockRGB.css("display", "none");
blockWeights.css("display", "none");
blockTransition.css("display", "none");
if(selectedValue === "Composite"){
blockWeights.css("display", "block");
blockElevation.css("display", "block");
blockRGB.css("display", "block");
blockIntensity.css("display", "block");
}
});
if(selectedValue === "Elevation"){
blockElevation.css("display", "block");
}
if(selectedValue === "RGB and Elevation"){
blockRGB.css("display", "block");
blockElevation.css("display", "block");
}
if(selectedValue === "RGB"){
blockRGB.css("display", "block");
}
if(selectedValue === "Intensity"){
blockIntensity.css("display", "block");
}
if(selectedValue === "Intensity Gradient"){
blockIntensity.css("display", "block");
}
};
$("#optMaterial").selectmenu({change: updateMaterialPanel});
$("#optMaterial").val(viewer.getMaterialName()).selectmenu("refresh");
updateMaterialPanel();
}
function initClassificationList(){
@ -1103,6 +1375,9 @@ $(document).ready( function() {
initSettings()
$('#potree_version_number').html(Potree.version.major + "." + Potree.version.minor + Potree.version.suffix);
//$('#potree_sidebar_container').perfectScrollbar();
//$('#sidebar_root').perfectScrollbar();
$('.perfect_scrollbar').perfectScrollbar();
});

View File

@ -1,28 +1,16 @@
Potree.Shaders["pointcloud.vs"] = [
"",
"// the following is an incomplete list of attributes, uniforms and defines",
"// which are automatically added through the THREE.ShaderMaterial",
"precision mediump float;",
"precision mediump int;",
"",
"//attribute vec3 position;",
"//attribute vec3 color;",
"//attribute vec3 normal;",
"",
"//uniform mat4 modelMatrix;",
"//uniform mat4 modelViewMatrix;",
"//uniform mat4 projectionMatrix;",
"//uniform mat4 viewMatrix;",
"//uniform mat3 normalMatrix;",
"//uniform vec3 cameraPosition;",
"",
"//#define MAX_DIR_LIGHTS 0",
"//#define MAX_POINT_LIGHTS 1",
"//#define MAX_SPOT_LIGHTS 0",
"//#define MAX_HEMI_LIGHTS 0",
"//#define MAX_SHADOWS 0",
"//#define MAX_BONES 58",
"",
"#define max_clip_boxes 30",
"",
"attribute vec3 position;",
"attribute vec3 color;",
"attribute vec3 normal;",
"attribute float intensity;",
"attribute float classification;",
"attribute float returnNumber;",
@ -30,6 +18,13 @@ Potree.Shaders["pointcloud.vs"] = [
"attribute float pointSourceID;",
"attribute vec4 indices;",
"",
"uniform mat4 modelMatrix;",
"uniform mat4 modelViewMatrix;",
"uniform mat4 projectionMatrix;",
"uniform mat4 viewMatrix;",
"uniform mat3 normalMatrix;",
"",
"",
"uniform float screenWidth;",
"uniform float screenHeight;",
"uniform float fov;",
@ -56,6 +51,21 @@ Potree.Shaders["pointcloud.vs"] = [
"uniform float opacity;",
"uniform float clipBoxCount;",
"",
"uniform vec2 intensityRange;",
"uniform float intensityGamma;",
"uniform float intensityContrast;",
"uniform float intensityBrightness;",
"uniform float rgbGamma;",
"uniform float rgbContrast;",
"uniform float rgbBrightness;",
"uniform float transition;",
"uniform float wRGB;",
"uniform float wIntensity;",
"uniform float wElevation;",
"uniform float wClassification;",
"uniform float wReturnNumber;",
"uniform float wSourceID;",
"",
"",
"uniform sampler2D visibleNodes;",
"uniform sampler2D gradient;",
@ -211,6 +221,100 @@ Potree.Shaders["pointcloud.vs"] = [
"",
"#endif",
"",
"// formula adapted from: http://www.dfstudios.co.uk/articles/programming/image-programming-algorithms/image-processing-algorithms-part-5-contrast-adjustment/",
"float getContrastFactor(float contrast){",
" return (1.0158730158730156 * (contrast + 1.0)) / (1.0158730158730156 - contrast);",
"}",
"",
"vec3 getRGB(){",
" vec3 rgb = color;",
" ",
" rgb = pow(rgb, vec3(rgbGamma));",
" rgb = rgb + rgbBrightness;",
" rgb = (rgb - 0.5) * getContrastFactor(rgbContrast) + 0.5;",
" rgb = clamp(rgb, 0.0, 1.0);",
" ",
" return rgb;",
"}",
"",
"float getIntensity(){",
" float w = (intensity - intensityRange.x) / (intensityRange.y - intensityRange.x);",
" w = pow(w, intensityGamma);",
" w = w + intensityBrightness;",
" w = (w - 0.5) * getContrastFactor(intensityContrast) + 0.5;",
" w = clamp(w, 0.0, 1.0);",
" ",
" return w;",
"}",
"",
"vec3 getElevation(){",
" vec4 world = modelMatrix * vec4( position, 1.0 );",
" float w = (world.y - heightMin) / (heightMax-heightMin);",
" vec3 cElevation = texture2D(gradient, vec2(w,1.0-w)).rgb;",
" ",
" return cElevation;",
"}",
"",
"vec4 getClassification(){",
" float c = mod(classification, 16.0);",
" vec2 uv = vec2(c / 255.0, 0.5);",
" vec4 classColor = texture2D(classificationLUT, uv);",
" ",
" return classColor;",
"}",
"",
"vec3 getReturnNumber(){",
" if(numberOfReturns == 1.0){",
" return vec3(1.0, 1.0, 0.0);",
" }else{",
" if(returnNumber == 1.0){",
" return vec3(1.0, 0.0, 0.0);",
" }else if(returnNumber == numberOfReturns){",
" return vec3(0.0, 0.0, 1.0);",
" }else{",
" return vec3(0.0, 1.0, 0.0);",
" }",
" }",
"}",
"",
"vec3 getSourceID(){",
" float w = mod(pointSourceID, 10.0) / 10.0;",
" return texture2D(gradient, vec2(w,1.0 - w)).rgb;",
"}",
"",
"vec3 getCompositeColor(){",
" vec3 c;",
" float w;",
"",
" c += wRGB * getRGB();",
" w += wRGB;",
" ",
" c += wIntensity * getIntensity() * vec3(1.0, 1.0, 1.0);",
" w += wIntensity;",
" ",
" c += wElevation * getElevation();",
" w += wElevation;",
" ",
" c += wReturnNumber * getReturnNumber();",
" w += wReturnNumber;",
" ",
" c += wSourceID * getSourceID();",
" w += wSourceID;",
" ",
" vec4 cl = wClassification * getClassification();",
" c += cl.a * cl.rgb;",
" w += wClassification * cl.a;",
"",
" c = c / w;",
" ",
" if(w == 0.0){",
" //c = color;",
" gl_Position = vec4(100.0, 100.0, 100.0, 0.0);",
" }",
" ",
" return c;",
"}",
"",
"void main() {",
" vec4 worldPosition = modelMatrix * vec4( position, 1.0 );",
" vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",
@ -225,71 +329,54 @@ Potree.Shaders["pointcloud.vs"] = [
" // ---------------------",
" // POINT COLOR",
" // ---------------------",
" vec4 cl = getClassification(); ",
" ",
" #ifdef color_type_rgb",
" vColor = color;",
" vColor = getRGB();",
" #elif defined color_type_height",
" vec4 world = modelMatrix * vec4( position, 1.0 );",
" float w = (world.y - heightMin) / (heightMax-heightMin);",
" vColor = texture2D(gradient, vec2(w,1.0-w)).rgb;",
" vColor = getElevation();",
" #elif defined color_type_rgb_height",
" vec3 cHeight = getElevation();",
" vColor = (1.0 - transition) * getRGB() + transition * cHeight;",
" #elif defined color_type_depth",
" 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);",
" float w = getIntensity();",
" vColor = vec3(w, w, w);",
" #elif defined color_type_intensity_gradient",
" float w = (intensity - intensityMin) / intensityMax;",
" float w = getIntensity();",
" vColor = texture2D(gradient, vec2(w,1.0-w)).rgb;",
" #elif defined color_type_color",
" vColor = uColor;",
" #elif defined color_type_lod",
" float depth = getLOD();",
" float w = depth / 10.0;",
" //float w = mod(depth, 4.0) / 3.0;",
" vColor = texture2D(gradient, vec2(w,1.0-w)).rgb;",
" #elif defined color_type_point_index",
" vColor = indices.rgb;",
" #elif defined color_type_classification",
" float c = mod(classification, 16.0);",
" vec2 uv = vec2(c / 255.0, 0.5);",
" vec4 classColor = texture2D(classificationLUT, uv);",
" vColor = classColor.rgb;",
" vColor = cl.rgb;",
" #elif defined color_type_return_number",
" 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);",
" }",
" }",
" vColor = getReturnNumber();",
" #elif defined color_type_source",
" float w = mod(pointSourceID, 10.0) / 10.0;",
" vColor = texture2D(gradient, vec2(w,1.0 - w)).rgb;",
" vColor = getSourceID();",
" #elif defined color_type_normal",
" vColor = (modelMatrix * vec4(normal, 0.0)).xyz;",
" #elif defined color_type_phong",
" vColor = color;",
" #elif defined color_type_composite",
" vColor = getCompositeColor();",
" #endif",
" ",
" {",
" // TODO might want to combine with the define block above to avoid reading same LUT two times",
" float c = mod(classification, 16.0);",
" vec2 uv = vec2(c / 255.0, 0.5);",
" ",
" if(texture2D(classificationLUT, uv).a == 0.0){",
" #if !defined color_type_composite",
" if(cl.a == 0.0){",
" gl_Position = vec4(100.0, 100.0, 100.0, 0.0);",
" ",
" return;",
" }",
" }",
" ",
" //if(vNormal.z < 0.0){",
" // gl_Position = vec4(1000.0, 1000.0, 1000.0, 1.0);",
" //}",
" #endif",
" ",
" // ---------------------",
" // POINT SIZE",
@ -346,19 +433,6 @@ Potree.Shaders["pointcloud.vs"] = [
" #if defined clip_highlight_inside",
" vColor.r += 0.5;",
" #endif",
" ",
" //vec3 cp = clipBoxPositions[0];",
" //vec3 diff = vWorldPosition - cp;",
" //vec3 dir = normalize(diff);",
" //dir.z = 0.0;",
" //dir = normalize(dir);",
" //",
" //vec4 worldPosition = modelMatrix * vec4( position + dir * 20.0, 1.0 );",
" //vec4 mvPosition = modelViewMatrix * vec4( position + dir * 20.0, 1.0 );",
" //vViewPosition = -mvPosition.xyz;",
" //vWorldPosition = worldPosition.xyz;",
" //gl_Position = projectionMatrix * mvPosition;",
" ",
" }",
" ",
" #endif",
@ -368,64 +442,21 @@ Potree.Shaders["pointcloud.vs"] = [
].join("\n");
Potree.Shaders["pointcloud.fs"] = [
"",
"precision mediump float;",
"precision mediump int;",
"",
"#if defined use_interpolation",
" #extension GL_EXT_frag_depth : enable",
"#endif",
"",
"",
"// the following is an incomplete list of attributes, uniforms and defines",
"// which are automatically added through the THREE.ShaderMaterial",
"",
"// #define USE_COLOR",
"// ",
"// uniform mat4 viewMatrix;",
"// uniform vec3 cameraPosition;",
"uniform mat4 viewMatrix;",
"uniform vec3 cameraPosition;",
"",
"",
"uniform mat4 projectionMatrix;",
"uniform float opacity;",
"",
"",
"#if defined(color_type_phong)",
"",
" uniform vec3 diffuse;",
" uniform vec3 ambient;",
" uniform vec3 emissive;",
" uniform vec3 specular;",
" uniform float shininess;",
" uniform vec3 ambientLightColor;",
"",
" #if MAX_POINT_LIGHTS > 0",
"",
" 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",
"",
" #if MAX_DIR_LIGHTS > 0",
"",
" uniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];",
" uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];",
"",
" #endif",
"",
"#endif",
"",
"//#if MAX_SPOT_LIGHTS > 0",
"//",
"// uniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];",
"// uniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];",
"// uniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];",
"// uniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];",
"// uniform float spotLightExponent[ MAX_SPOT_LIGHTS ];",
"//",
"// uniform float spotLightDistance[ MAX_SPOT_LIGHTS ];",
"//",
"//#endif",
"",
"uniform float blendHardness;",
"uniform float blendDepthSupplement;",
"uniform float fov;",

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -161,8 +161,11 @@ Potree.PointCloudMaterial = function(parameters){
transition: { type: "f", value: 0.5 },
intensityRange: { type: "fv", value: [0, 65000] },
intensityGamma: { type: "f", value: 1 },
intensityContrast: { type: "f", value: 1 },
intensityContrast: { type: "f", value: 0 },
intensityBrightness:{ type: "f", value: 0 },
rgbGamma: { type: "f", value: 1 },
rgbContrast: { type: "f", value: 0 },
rgbBrightness: { type: "f", value: 0 },
wRGB: { type: "f", value: 1 },
wIntensity: { type: "f", value: 0 },
wElevation: { type: "f", value: 0 },

View File

@ -54,6 +54,9 @@ uniform vec2 intensityRange;
uniform float intensityGamma;
uniform float intensityContrast;
uniform float intensityBrightness;
uniform float rgbGamma;
uniform float rgbContrast;
uniform float rgbBrightness;
uniform float transition;
uniform float wRGB;
uniform float wIntensity;
@ -217,11 +220,27 @@ float getPointSizeAttenuation(){
#endif
// formula adapted from: http://www.dfstudios.co.uk/articles/programming/image-programming-algorithms/image-processing-algorithms-part-5-contrast-adjustment/
float getContrastFactor(float contrast){
return (1.0158730158730156 * (contrast + 1.0)) / (1.0158730158730156 - contrast);
}
vec3 getRGB(){
vec3 rgb = color;
rgb = pow(rgb, vec3(rgbGamma));
rgb = rgb + rgbBrightness;
rgb = (rgb - 0.5) * getContrastFactor(rgbContrast) + 0.5;
rgb = clamp(rgb, 0.0, 1.0);
return rgb;
}
float getIntensity(){
float w = (intensity - intensityRange.x) / (intensityRange.y - intensityRange.x);
w = pow(w, intensityGamma);
w = (w - 0.5) * intensityContrast + 0.5;
w = w + intensityBrightness;
w = (w - 0.5) * getContrastFactor(intensityContrast) + 0.5;
w = clamp(w, 0.0, 1.0);
return w;
@ -262,11 +281,11 @@ vec3 getSourceID(){
return texture2D(gradient, vec2(w,1.0 - w)).rgb;
}
vec3 getColor(){
vec3 getCompositeColor(){
vec3 c;
float w;
c += wRGB * color;
c += wRGB * getRGB();
w += wRGB;
c += wIntensity * getIntensity() * vec3(1.0, 1.0, 1.0);
@ -312,12 +331,12 @@ void main() {
vec4 cl = getClassification();
#ifdef color_type_rgb
vColor = color;
vColor = getRGB();
#elif defined color_type_height
vColor = getElevation();
#elif defined color_type_rgb_height
vec3 cHeight = getElevation();
vColor = (1.0 - transition) * color + transition * cHeight;
vColor = (1.0 - transition) * getRGB() + transition * cHeight;
#elif defined color_type_depth
float linearDepth = -mvPosition.z ;
float expDepth = (gl_Position.z / gl_Position.w) * 0.5 + 0.5;
@ -347,7 +366,7 @@ void main() {
#elif defined color_type_phong
vColor = color;
#elif defined color_type_composite
vColor = getColor();
vColor = getCompositeColor();
#endif
#if !defined color_type_composite

View File

@ -404,6 +404,42 @@ body{
.divider {
display: block;
text-align: center;
overflow: hidden;
white-space: nowrap;
font-weight: bold;
font-size: 90%;
letter-spacing: 1px;
margin-left: -20px;
margin-right: -20px;
}
.divider > span {
position: relative;
display: inline-block;
}
.divider > span:before,
.divider > span:after {
content: "";
position: absolute;
top: 50%;
width: 9999px;
height: 1px;
background: #b2b2b2;
}
.divider > span:before {
right: 100%;
margin-right: 5px;
}
.divider > span:after {
left: 100%;
margin-left: 5px;
}

View File

@ -48,13 +48,16 @@
<li><label class="menu-item"><input type="checkbox" onClick="viewer.setShowSkybox(this.checked)"/><span data-i18n="appearance.skybox"></span</label></li>
<li class="pv-divider"></li>
<li class="pv-menu-list-header">Eye-Dome-Lighting</li>
<li><label><input type="checkbox" id="chkEDLEnabled" onClick="viewer.setEDLEnabled(this.checked)"/><span data-i18n="appearance.edl_enable"></span></label></li>
<li><span data-i18n="appearance.edl_radius"></span>:<span id="lblEDLRadius"></span><div id="sldEDLRadius"></div></li>
<li><span data-i18n="appearance.edl_strength"></span>:<span id="lblEDLStrength"></span><div id="sldEDLStrength"></div></li>
<div>
<div class="divider">
<span>Eye-Dome-Lighting</span>
</div>
<li><label><input type="checkbox" id="chkEDLEnabled" onClick="viewer.setEDLEnabled(this.checked)"/><span data-i18n="appearance.edl_enable"></span></label></li>
<li><span data-i18n="appearance.edl_radius"></span>:<span id="lblEDLRadius"></span><div id="sldEDLRadius"></div></li>
<li><span data-i18n="appearance.edl_strength"></span>:<span id="lblEDLStrength"></span><div id="sldEDLStrength"></div></li>
</div>
</ul>
</div>
@ -80,27 +83,16 @@
<div>
<ul class="pv-menu-list">
<li>
<label for="optMaterial" class="pv-select-label"></label><br>
<label for="optMaterial" class="pv-select-label">Attributes:</label><br>
<select id="optMaterial" name="optMaterial">
</select>
</li>
<div id="materials.elevation_container">
<li><span data-i18n="appearance.elevation_range"></span>: <span id="lblHeightRange"></span> <div id="sldHeightRange"></div> </li>
</div>
<div id="materials.transition_container">
<li>transition: <span id="lblTransition"></span> <div id="sldTransition"></div> </li>
</div>
<div id="materials.intensity_container">
<li>Intensity Range: <span id="lblIntensityRange"></span> <div id="sldIntensityRange"></div> </li>
<li>Gamma: <span id="lblIntensityGamma"></span> <div id="sldIntensityGamma"></div> </li>
<li>Contrast: <span id="lblIntensityContrast"></span> <div id="sldIntensityContrast"></div> </li>
<li>Brightness: <span id="lblIntensityBrightness"></span> <div id="sldIntensityBrightness"></div> </li>
</div>
<div id="materials.composite_weight_container">
<div class="divider">
<span>Attribute Weights</span>
</div>
<li>RGB: <span id="lblWeightRGB"></span> <div id="sldWeightRGB"></div> </li>
<li>Intensity: <span id="lblWeightIntensity"></span> <div id="sldWeightIntensity"></div> </li>
<li>Elevation: <span id="lblWeightElevation"></span> <div id="sldWeightElevation"></div> </li>
@ -109,6 +101,45 @@
<li>Source ID: <span id="lblWeightSourceID"></span> <div id="sldWeightSourceID"></div> </li>
</div>
<div id="materials.rgb_container">
<div class="divider">
<span>RGB</span>
</div>
<li>Gamma: <span id="lblRGBGamma"></span> <div id="sldRGBGamma"></div> </li>
<li>Brightness: <span id="lblRGBBrightness"></span> <div id="sldRGBBrightness"></div> </li>
<li>Contrast: <span id="lblRGBContrast"></span> <div id="sldRGBContrast"></div> </li>
</div>
<div id="materials.elevation_container">
<div class="divider">
<span>Elevation</span>
</div>
<li><span data-i18n="appearance.elevation_range"></span>: <span id="lblHeightRange"></span> <div id="sldHeightRange"></div> </li>
</div>
<div id="materials.transition_container">
<div class="divider">
<span>Transition</span>
</div>
<li>transition: <span id="lblTransition"></span> <div id="sldTransition"></div> </li>
</div>
<div id="materials.intensity_container">
<div class="divider">
<span>Intensity</span>
</div>
<li>Range: <span id="lblIntensityRange"></span> <div id="sldIntensityRange"></div> </li>
<li>Gamma: <span id="lblIntensityGamma"></span> <div id="sldIntensityGamma"></div> </li>
<li>Brightness: <span id="lblIntensityBrightness"></span> <div id="sldIntensityBrightness"></div> </li>
<li>Contrast: <span id="lblIntensityContrast"></span> <div id="sldIntensityContrast"></div> </li>
</div>
</ul>
<!--<ul id="materialList" class="pv-menu-list"></ul>-->
</div>
@ -326,20 +357,44 @@ function initMaterials(){
$( "#sldIntensityContrast" ).slider({
value: viewer.getIntensityContrast(),
min: 0,
max: 2,
min: -1,
max: 1,
step: 0.01,
slide: function( event, ui ) {viewer.setIntensityContrast(ui.value);}
});
$( "#sldIntensityBrightness" ).slider({
value: viewer.getIntensityBrightness(),
min: 0,
max: 2,
min: -1,
max: 1,
step: 0.01,
slide: function( event, ui ) {viewer.setIntensityBrightness(ui.value);}
});
$( "#sldRGBGamma" ).slider({
value: viewer.getRGBGamma(),
min: 0,
max: 4,
step: 0.01,
slide: function( event, ui ) {viewer.setRGBGamma(ui.value);}
});
$( "#sldRGBContrast" ).slider({
value: viewer.getRGBContrast(),
min: -1,
max: 1,
step: 0.01,
slide: function( event, ui ) {viewer.setRGBContrast(ui.value);}
});
$( "#sldRGBBrightness" ).slider({
value: viewer.getRGBBrightness(),
min: -1,
max: 1,
step: 0.01,
slide: function( event, ui ) {viewer.setRGBBrightness(ui.value);}
});
$( "#sldWeightRGB" ).slider({
value: viewer.getWeightRGB(),
min: 0,
@ -432,31 +487,56 @@ function initMaterials(){
viewer.addEventListener("intensity_gamma_changed", function(event){
let gamma = viewer.getIntensityGamma();
$('#lblIntensityGamma')[0].innerHTML = gamma.toFixed(1);
$('#lblIntensityGamma')[0].innerHTML = gamma.toFixed(2);
$("#sldIntensityGamma").slider({value: gamma});
});
viewer.addEventListener("intensity_contrast_changed", function(event){
let contrast = viewer.getIntensityContrast();
$('#lblIntensityContrast')[0].innerHTML = contrast.toFixed(1);
$('#lblIntensityContrast')[0].innerHTML = contrast.toFixed(2);
$("#sldIntensityContrast").slider({value: contrast});
});
viewer.addEventListener("intensity_brightness_changed", function(event){
let brightness = viewer.getIntensityBrightness();
$('#lblIntensityBrightness')[0].innerHTML = brightness.toFixed(1);
$('#lblIntensityBrightness')[0].innerHTML = brightness.toFixed(2);
$("#sldIntensityBrightness").slider({value: brightness});
});
viewer.addEventListener("rgb_gamma_changed", function(event){
let gamma = viewer.getRGBGamma();
$('#lblRGBGamma')[0].innerHTML = gamma.toFixed(2);
$("#sldRGBGamma").slider({value: gamma});
});
viewer.addEventListener("rgb_contrast_changed", function(event){
let contrast = viewer.getRGBContrast();
$('#lblRGBContrast')[0].innerHTML = contrast.toFixed(2);
$("#sldRGBContrast").slider({value: contrast});
});
viewer.addEventListener("rgb_brightness_changed", function(event){
let brightness = viewer.getRGBBrightness();
$('#lblRGBBrightness')[0].innerHTML = brightness.toFixed(2);
$("#sldRGBBrightness").slider({value: brightness});
});
viewer.addEventListener("pointcloud_loaded", updateHeightRange);
updateHeightRange();
updateIntensityRange();
$('#lblIntensityGamma')[0].innerHTML = viewer.getIntensityGamma().toFixed(1);
$('#lblIntensityContrast')[0].innerHTML = viewer.getIntensityContrast().toFixed(1);
$('#lblIntensityBrightness')[0].innerHTML = viewer.getIntensityBrightness().toFixed(1);
$('#lblIntensityGamma')[0].innerHTML = viewer.getIntensityGamma().toFixed(2);
$('#lblIntensityContrast')[0].innerHTML = viewer.getIntensityContrast().toFixed(2);
$('#lblIntensityBrightness')[0].innerHTML = viewer.getIntensityBrightness().toFixed(2);
$('#lblRGBGamma')[0].innerHTML = viewer.getRGBGamma().toFixed(2);
$('#lblRGBContrast')[0].innerHTML = viewer.getRGBContrast().toFixed(2);
$('#lblRGBBrightness')[0].innerHTML = viewer.getRGBBrightness().toFixed(2);
var options = [
"RGB",
@ -492,18 +572,21 @@ function initMaterials(){
let blockWeights = $("#materials\\.composite_weight_container");
let blockElevation = $("#materials\\.elevation_container");
let blockRGB = $("#materials\\.rgb_container");
let blockIntensity = $("#materials\\.intensity_container");
let blockTransition = $("#materials\\.transition_container");
blockIntensity.css("display", "none");
blockElevation.css("display", "none");
blockRGB.css("display", "none");
blockWeights.css("display", "none");
blockTransition.css("display", "none");
if(selectedValue === "Composite"){
blockIntensity.css("display", "block");
blockElevation.css("display", "block");
blockWeights.css("display", "block");
blockElevation.css("display", "block");
blockRGB.css("display", "block");
blockIntensity.css("display", "block");
}
if(selectedValue === "Elevation"){
@ -511,9 +594,14 @@ function initMaterials(){
}
if(selectedValue === "RGB and Elevation"){
blockRGB.css("display", "block");
blockElevation.css("display", "block");
}
if(selectedValue === "RGB"){
blockRGB.css("display", "block");
}
if(selectedValue === "Intensity"){
blockIntensity.css("display", "block");
}

View File

@ -44,8 +44,11 @@ Potree.Viewer = function(domElement, args){
this.weightSourceID = 0.0;
this.intensityRange = [0, 65000];
this.intensityGamma = 1;
this.intensityContrast = 1;
this.intensityContrast = 0;
this.intensityBrightness = 0;
this.rgbGamma = 1;
this.rgbContrast = 0;
this.rgbBrightness = 0;
this.moveSpeed = 10;
@ -340,6 +343,39 @@ Potree.Viewer = function(domElement, args){
return scope.intensityBrightness;
};
this.setRGBGamma = function(value){
if(scope.rgbGamma !== value){
scope.rgbGamma = value;
scope.dispatchEvent({"type": "rgb_gamma_changed", "viewer": scope});
}
};
this.getRGBGamma = function(){
return scope.rgbGamma;
};
this.setRGBContrast = function(value){
if(scope.rgbContrast !== value){
scope.rgbContrast = value;
scope.dispatchEvent({"type": "rgb_contrast_changed", "viewer": scope});
}
};
this.getRGBContrast = function(){
return scope.rgbContrast;
};
this.setRGBBrightness = function(value){
if(scope.rgbBrightness !== value){
scope.rgbBrightness = value;
scope.dispatchEvent({"type": "rgb_brightness_changed", "viewer": scope});
}
};
this.getRGBBrightness = function(){
return scope.rgbBrightness;
};
this.setMaterialTransition = function(t){
if(scope.materialTransition !== t){
scope.materialTransition = t;
@ -1462,6 +1498,9 @@ Potree.Viewer = function(domElement, args){
pointcloud.material.uniforms.intensityGamma.value = scope.getIntensityGamma();
pointcloud.material.uniforms.intensityContrast.value = scope.getIntensityContrast();
pointcloud.material.uniforms.intensityBrightness.value = scope.getIntensityBrightness();
pointcloud.material.uniforms.rgbGamma.value = scope.getRGBGamma();
pointcloud.material.uniforms.rgbContrast.value = scope.getRGBContrast();
pointcloud.material.uniforms.rgbBrightness.value = scope.getRGBBrightness();
pointcloud.showBoundingBox = scope.showBoundingBox;
pointcloud.generateDEM = scope.useDEMCollisions;
pointcloud.minimumNodePixelSize = scope.minNodeSize;