-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
3D Tiles - Point Cloud Styling #4336
Merged
Merged
Changes from 25 commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
41fc014
pnts shader styling
lilleyse 46d00e3
Merge branch '3d-tiles' into pnts-styling
lilleyse 8e98836
Organization
lilleyse b7c2dfd
Rearrange shader construction
lilleyse cc1c4e6
Reorganize parameters and support ARRAY type
lilleyse 5cb1088
Change conditions from an object to an array
lilleyse 758ebb2
Change how result params are used
lilleyse 9d2838e
Stricter type comparisons
lilleyse 096b15b
Reset scratch index for Expression.evaluate
lilleyse 976f32f
Fix tests
lilleyse 953f9be
Merge branch '3d-tiles' into pnts-styling
lilleyse 1fd4b27
Calculate literal colors right away
lilleyse dbd681d
Limit array length
lilleyse 75beb23
Added Point Cloud Styling sandcastle
lilleyse 72ee217
Add back TODO
lilleyse 88903d5
More detailed shader error messages, removed type-checking errors in …
lilleyse 62ecd50
Revert ExpressionSpec
lilleyse 7754b66
Reorganzation of styleContent
lilleyse cab3705
Add BATCH_ID comment
lilleyse 464cee8
Added ability to style based on POSITION, COLOR, and NORMAL semantics
lilleyse 18be9d6
Support DOUBLE, INT, and UNSIGNED_INT point cloud style properties
lilleyse 079d6f6
Added tests
lilleyse 6d8a879
Tweak test for OIT
lilleyse 84d8ff7
Log warning for float conversion
lilleyse a217024
Style point size
lilleyse 55cf834
Change === to == and !== to !=
lilleyse 8823472
Rename size to pointSize
lilleyse c04ff78
Support both === and !==
lilleyse f0f86ad
Merge branch '3d-tiles' into pnts-styling
lilleyse 83efc1b
Fix styling edge case
lilleyse 45d96d8
Merge branch '3d-tiles' into pnts-styling
lilleyse File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
170 changes: 170 additions & 0 deletions
170
Apps/Sandcastle/gallery/3D Tiles Point Cloud Styling.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,170 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"> <!-- Use Chrome Frame in IE --> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"> | ||
<meta name="description" content="Use Viewer to start building new applications or easily embed Cesium into existing applications."> | ||
<meta name="cesium-sandcastle-labels" content="Showcases"> | ||
<title>Cesium Demo</title> | ||
<script type="text/javascript" src="../Sandcastle-header.js"></script> | ||
<script type="text/javascript" src="../../../ThirdParty/requirejs-2.1.20/require.js"></script> | ||
<script type="text/javascript"> | ||
require.config({ | ||
baseUrl : '../../../Source', | ||
waitSeconds : 60 | ||
}); | ||
</script> | ||
</head> | ||
<body class="sandcastle-loading" data-sandcastle-bucket="bucket-requirejs.html"> | ||
<style> | ||
@import url(../templates/bucket.css); | ||
#toolbar button { display: block; } | ||
</style> | ||
<div id="cesiumContainer" class="fullSize"></div> | ||
<div id="loadingOverlay"><h1>Loading...</h1></div> | ||
<div id="toolbar"></div> | ||
<script id="cesium_sandcastle_script"> | ||
function startup(Cesium) { | ||
'use strict'; | ||
//Sandcastle_Begin | ||
|
||
var viewer = new Cesium.Viewer('cesiumContainer', { | ||
scene3DOnly : true | ||
}); | ||
|
||
var scene = viewer.scene; | ||
var url = '../../../Specs/Data/Cesium3DTiles/PointCloud/PointCloudWithPerPointProperties/'; | ||
|
||
var tileset = scene.primitives.add(new Cesium.Cesium3DTileset({ | ||
url : url | ||
})); | ||
|
||
tileset.readyPromise.then(function(tileset) { | ||
var boundingSphere = tileset.boundingSphere; | ||
viewer.camera.viewBoundingSphere(boundingSphere, new Cesium.HeadingPitchRange(0, -2.0, 0)); | ||
}); | ||
|
||
var styles = []; | ||
function addStyle(name, style) { | ||
styles.push({ | ||
name : name, | ||
style : style | ||
}); | ||
} | ||
|
||
addStyle('No Style', {}); | ||
|
||
addStyle('Red', { | ||
color : "color('#ff0000')" | ||
}); | ||
|
||
addStyle('Color Gradient', { | ||
color : "color() * ${temperature}" | ||
}); | ||
|
||
addStyle('Step Red/Blue', { | ||
color : "${temperature} > 0.5 ? color('red') : color('blue')" | ||
}); | ||
|
||
addStyle('Interpolate Red/Blue', { | ||
color : "color('red') * ${temperature} + color('blue') * (1.0 - ${temperature})" | ||
}); | ||
|
||
addStyle('Color Ramp', { | ||
color : { | ||
conditions : [ | ||
["${temperature} < 0.1", "color('#000099')"], | ||
["${temperature} < 0.2", "color('#00cc99', 1.0)"], | ||
["${temperature} < 0.3", "color('#66ff33', 0.5)"], | ||
["${temperature} < 0.4", "rgba(255, 255, 0, 0.1)"], | ||
["${temperature} < 0.5", "rgb(255, 128, 0)"], | ||
["${temperature} < 0.6", "color('red')"], | ||
["${temperature} < 0.7", "color('rgb(255, 102, 102)')"], | ||
["${temperature} < 0.8", "hsl(0.875, 1.0, 0.6)"], | ||
["${temperature} < 0.9", "hsla(0.83, 1.0, 0.5, 0.1)"], | ||
["true", "color('#FFFFFF', 1.0)"] | ||
] | ||
} | ||
}); | ||
|
||
addStyle('Transparency', { | ||
color : "rgba(0, 255, 0, ${temperature})" | ||
}); | ||
|
||
addStyle('Hide Low Temperature', { | ||
color : "rgb(${temperature}*255, 0, 0)", | ||
show : "${temperature} > 0.3" | ||
}); | ||
|
||
addStyle('Show Subsections', { | ||
show : "${id} === 1 || ${id} > 250 && ${id} < 300" | ||
}); | ||
|
||
addStyle('Mod', { | ||
show : "${id} % 2 === 0" | ||
}); | ||
|
||
addStyle('Secondary Color', { | ||
color : { | ||
expression : "[${secondaryColor}[0], ${secondaryColor}[1], ${secondaryColor}[2], 1.0]", | ||
conditions : [ | ||
["${id} < 250", "${expression}"], | ||
["${id} < 500", "${expression} * ${expression}"], | ||
["${id} < 750", "${expression} / 5.0"], | ||
["${id} < 1000", "rgb(0, 0, Number(${expression}[0] < 0.5) * 255)"] | ||
] | ||
} | ||
}); | ||
|
||
addStyle('Use point colors', { | ||
color : "${COLOR} * ${temperature} + rgb(128,128,128)" | ||
}); | ||
|
||
addStyle('Use point positions', { | ||
show : "${POSITION}[0] > 0.5 || ${POSITION}[1] > 0.5 || ${POSITION}[2] > 0.5" | ||
}); | ||
|
||
addStyle('Color based on position', { | ||
color : "rgb(${POSITION}[0] * 255, ${POSITION}[1] * 255, ${POSITION}[2] * 255)" | ||
}); | ||
|
||
addStyle('Style point size', { | ||
color : "color('red')", | ||
size : "${temperature} * 10" | ||
}); | ||
|
||
function setStyle(style) { | ||
tileset.style = new Cesium.Cesium3DTileStyle(style); | ||
} | ||
|
||
function getSetStyleFunction(style) { | ||
return function() { | ||
setStyle(style); | ||
}; | ||
} | ||
|
||
var styleOptions = []; | ||
for (var j = 0; j < styles.length; ++j) { | ||
var style = styles[j]; | ||
styleOptions.push({ | ||
text : style.name, | ||
onselect : getSetStyleFunction(style.style) | ||
}); | ||
} | ||
|
||
Sandcastle.addToolbarMenu(styleOptions); | ||
|
||
/////////////////////////////////////////////////////////////////////////////// | ||
|
||
//Sandcastle_End | ||
Sandcastle.finishedLoading(); | ||
} | ||
if (typeof Cesium !== "undefined") { | ||
startup(Cesium); | ||
} else if (typeof require === "function") { | ||
require(["Cesium"], startup); | ||
} | ||
</script> | ||
</body> | ||
</html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why call this
size
? Why not call it precisely what it is:pointSize
, and in the reference doc explain that it defines the point size in pixels when styling point cloud tiles.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My thinking was a generic name would be good for other sizeable things thing billboards. If fine with either way.