-
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
Automatic Globe depth texture #2506
Merged
Merged
Changes from all commits
Commits
Show all changes
179 commits
Select commit
Hold shift + click to select a range
42e4b8d
Automatic globe depth texture uniform WIP.
bagnell 75c7b7e
Fix OIT.
bagnell 836525a
Fix FXAA and texture changed tests.
bagnell e45c6ae
Fix picking and multifrustum tests.
bagnell 851f5ba
Add path if framebuffer cannot be created. Add test for czm_globeDept…
bagnell f863026
Fix doc
pjcozzi 4234b92
Merge branch 'master' into globe-depth
pjcozzi 7a3b72d
Merge remote-tracking branch 'origin/master' into globe-depth
pjcozzi 7068771
Merge remote-tracking branch 'origin/master' into globe-depth
pjcozzi ea14b36
Merge branch 'master' into globe-depth
bagnell da896c5
Properly clean up textures and fbos in resize.
bagnell 96ec329
Updates from review and some clean up.
bagnell c517422
Merge branch 'master' into globe-depth
bagnell 8dd9c45
Merge branch 'master' into globe-depth
bagnell 29bffa1
Fix for disabling OIT at the scene level.
bagnell a0bd017
Merge branch 'master' into globe-depth
bagnell f9e2ddb
Move globe depth framebuffers and commands out of Scene.
bagnell 1951d40
Clean up unused members in Scene.
bagnell 0aca330
Fix FXAA when OIT is disabled.
bagnell c37e26f
Properly destroy WebGL resources.
bagnell e750be4
Merge branch 'master' into globe-depth
bagnell 9071ec7
Fix tests after merge.
bagnell 8e827a9
Fix picking when depth textures are not available and enable FXAA by …
bagnell f527f07
Use pass through shader with depth texture to copy globe depth.
bagnell 1a53ed0
Update Sandcastle examples that have geometry with outlines.
bagnell 45a75a6
Declare commands and properly release shaders.
bagnell 9cc2bdb
Update CHANGES.md.
bagnell 0d5e547
Updates from review.
bagnell e309a5b
Rename _depthStencilGlobeTest to _globeDepthTexture.
bagnell 8841604
Avoid extra fullscreen draw call when not using OIT.
bagnell 3bf734a
Merge branch 'master' into globe-depth
bagnell 3aa52ce
Added option to show globe depth to CesiumInspector.
fstoner 6cea1f2
Interrim updates.
fstoner 000eccc
Adding comments to command execution.
fstoner 14377ef
More comments for scene rendering functions.
fstoner 0fdaec2
Merge branch 'master' into globe-depth
bagnell 1a2f182
Moving rendering to scene.
fstoner d5170de
Have single frustum working now.
fstoner ae2cbca
Simplifying fragment shader.
fstoner deb198a
Using monochrome color scheme.
fstoner d8afb6c
Adding some variations to the shader program.
fstoner 8efe092
Added option to show globe depth to CesiumInspector.
fstoner 336e544
Interrim updates.
fstoner 095840c
Adding comments to command execution.
fstoner 36fa31f
More comments for scene rendering functions.
fstoner 4725fce
Moving rendering to scene.
fstoner a0d932c
Have single frustum working now.
fstoner b9f2e42
Simplifying fragment shader.
fstoner afbdcb3
Using monochrome color scheme.
fstoner a52da5c
Adding some variations to the shader program.
fstoner 96c9984
Merge branch 'globe-depth-debug-view' of github.com:fstoner/cesium in…
fstoner eb1f904
Adding frustum selectors to UI.
fstoner e7f309b
Connecting frustum selector.
fstoner 09d050f
Removing dependency on frustum statistics.
fstoner b5d1cf0
Better document construction.
fstoner 97ad62f
Some tweaks.
fstoner 1398091
More cleanup.
fstoner 845f2e7
More cleanup.
fstoner fbe4385
Making globe depth debug objects private.
fstoner 45b0851
Updated CHANGES.md.
fstoner ff5f02e
Clean up comments
pjcozzi 32feca4
Removed extraneous comment.
fstoner 66ccd94
Cleaning up shader program destruction.
fstoner 7374fb9
Removing commented out shader code.
fstoner 0e12444
Exposing Scene.numberOfFrustums as a private property.
fstoner 44a4fee
Making show globe depth frustum info update independent of show.
fstoner a8d07bc
Fixing typos for "frame buffer".
fstoner 82fb5b2
Removing use of frustum "slice".
fstoner 9854329
Refraining from creating the viewport command with each update.
fstoner 697bd05
Moving debug show-globe-depth functionality to GlobeDepth.
fstoner 2593b41
Interim modifications.
fstoner ddea8cf
Some framebuffer manipulation.
fstoner 8d7f4f8
Removing unused code.
fstoner f5905e4
More cleanup of GlobeDepth.
fstoner 14f30d7
Adding spec for debugShowGlobeDepth.
fstoner 7a05287
More code cleanup.
fstoner 1b2e5d2
Tweak doc
pjcozzi 75803ce
Allowing for contrast contral of globe depth.
fstoner 985d552
Increasing contrast in debug globe depth shader.
fstoner de3423f
Adding frech scene creation to failing tests.
fstoner 871f3af
A better fix for the failing tests.
fstoner de77bb9
Merge pull request #2625 from fstoner/globe-depth-debug-view
pjcozzi 23bd672
Merge branch 'master' into globe-depth
bagnell 19f3ff9
Clamp billboards to ground WIP.
bagnell 45265e3
Hook up callbacks when loading tiles in the quadtree. Billboards on t…
bagnell db403b6
Update quadtree callbacks when billboards are added or removed.
bagnell b7137f5
Move clamp control from billboard collection to billboard.
bagnell ac3aee2
Track clamped position differently from user provided position.
bagnell 5298834
Improve performance by not updating entire quadtree when adding or re…
bagnell 6abe6ed
Fix clamping to billboards to ground in 2D, Columbus view and when mo…
bagnell 83f5dc3
Only use one vertex texture fetch for the depth at the center of the …
bagnell aa31bce
Merge branch 'master' into globe-depth
bagnell cc013c4
Merge branch 'globe-depth' into billboard-clamp-to-ground
bagnell 9a76c64
Throttle billboards clamped to terrain to only pick the mesh in the g…
bagnell 4583516
Add clamp to ground option to labels.
bagnell 8840623
Clean up picking a terrain tile's mesh and fix billboards when create…
bagnell f115094
Use the frame number when updating callbacks for rendered tiles inste…
bagnell 27df468
Clamp the entire label instead of the individual billboards of the la…
bagnell 8ce9101
Check the last frame rendered and only use callbacks when a tile tran…
bagnell 0acc702
Improve performance. Associate data with the quadtree that will updat…
bagnell fefe944
Change clampToGround boolean to heightReference with enum that can be…
bagnell 1bdde11
Change method for determining billboard visibility.
bagnell e70d140
Add Sandcastle example clamping billboards to the ground.
bagnell 55cc7d3
Add attribute to billboards to compute label visibility.
bagnell 0ae305a
Only update billboard position on terrain loaded.
bagnell b25eac7
Remove updating the billboard on tile load. Update the position on ti…
bagnell 8d3377c
Fix updating height reference and changine position. Fixed columbus v…
bagnell ae61e7a
Update Sandcastle example.
bagnell b941902
Some updates base don review.
bagnell 3f719dd
Merge branch 'master' into globe-depth
bagnell 6fefe5b
Merge branch 'globe-depth' into billboard-clamp-to-ground
bagnell 2b5ae80
Rename maxSize to ownerSize. Update labels and other changes based on…
bagnell 220f3b2
More renames and updates based on review.
bagnell 2ff3d43
Add doc.
bagnell 6c722f9
Update computing screen space position for billboards and labels.
bagnell 9b1f561
Move time slicing code from the billboard/label collection to the qua…
bagnell 0b2a63a
Stop updating billboards/labels when the height for the lowest level …
bagnell 26d6ad5
Fix updating billboard/label height reference and position.
bagnell d9061fb
Rename from review.
bagnell fb7901e
Update Sandcastle example.
bagnell 344619d
Update doc.
bagnell f68c78b
Improve update performance.
bagnell 1770da4
Update labels/billboards when the terrain provider changes.
bagnell 9f7f1ab
Fix ciolumbus view. Clean up requires.
bagnell 58980dc
Re-add eye z offset.
bagnell 3b7c13b
Add tests for billboards/labels with height references and for the qu…
bagnell 7ca6a16
Merge branch 'master' into globe-depth
bagnell 83fd26d
Merge branch 'globe-depth' into billboard-clamp-to-ground
bagnell 9fff44c
Update CHANGES.md
bagnell 94dc317
Merge pull request #2653 from AnalyticalGraphicsInc/billboard-clamp-t…
pjcozzi 0b999f5
Copy the depth buffer after each frustum renders for later picking.
bagnell a7fe0cd
Return world space position of pick. Compress depth into unsigned byt…
bagnell 9df4e83
Merge branch 'master' into globe-depth
bagnell 8677981
Merge branch 'globe-depth' into pick-depth
bagnell d1f2205
Pick the depth buffer for mouse controls by default.
bagnell d65f2ca
Add doc and use result parameters.
bagnell a97dd5b
Throw if pickDepth is called but not supported. Update CHANGES.md.
bagnell 48027b4
Remove unecessary error checking code. Move depth packing to its own …
bagnell e93c6ad
Pack depth value into an unsigned byte for wider support and less mem…
bagnell 63c07fe
Clean up screen space camera controller.
bagnell feb7e5a
Fix tests.
bagnell cf077a9
Add pickDepth test.
bagnell ed2c987
Merge branch 'master' into globe-depth
bagnell bc0be76
Merge branch 'globe-depth' into pick-depth
bagnell e905b6a
Clean up OIT after globe depth updates.
bagnell a061907
Fix jsHint error.
bagnell 71440c7
Use closest point from picking depth buffer and ray intersection with…
bagnell 69907e0
Add Sandcastle example for picking the depth buffer.
bagnell ef1b657
Updates from review.
bagnell a2b07b4
Tweak picking depth. Update Sandcastle example to not use labels.
bagnell dfb64a4
Pick the position closest to the camera position when picking depth. …
bagnell 5c772f3
Fix packing/unpacking depth values from RGBA buffer.
bagnell 5db24b9
Merge branch 'master' into globe-depth
bagnell 94acf1d
Merge branch 'globe-depth' into pick-depth
bagnell b76e13d
Fix clamping billboards to the ground after depth buffer packing chan…
bagnell 5a7208f
Update Sandcastle example based on review.
bagnell d261529
Clean up picking Sandcastle example.
bagnell fe5c0cf
Fix missed rename and change pickDepth -> pickPosition.
bagnell 027ccab
Add Scene.pickPositionSupported.
bagnell 23937ee
Sandcastle example rename
pjcozzi a65515f
Adjust eye offset in picking Sandcastle example.
bagnell 2415333
Remove commented code.
bagnell 6604aff
Remove unecessary undefined check.
bagnell 54a2b86
Merge pull request #2700 from AnalyticalGraphicsInc/pick-depth
pjcozzi 6413fbe
Merge branch 'master' into globe-depth
bagnell 9c188bd
Fixes after merge from master.
bagnell 7f0f8d6
Remove billboard depth test in the vertex shader. Use fixed function …
bagnell 4a362bb
Remove owner size attribute for doing manual depth test on labels.
bagnell 8a3773c
Do not copy the globe depth by default.
bagnell 9e5a39b
Remove owner size attribute from vertex shader.
bagnell 286e853
Merge pull request #2755 from AnalyticalGraphicsInc/billboard-depth
pjcozzi a28ea65
Merge remote-tracking branch 'origin/master' into globe-depth
pjcozzi 9d6e86f
Fixes for CHANGES.md
pjcozzi 3e7fe6b
Use bgltf model and remove commented code in development example.
bagnell 8d769c1
Fix whitespace
pjcozzi d26e06b
Change based on review.
bagnell fbed6fb
Update CHANGES.md.
bagnell 351c802
Add unit test for Scene.copyGlobeDepth.
bagnell 73ad525
Merge remote-tracking branch 'origin/master' into globe-depth
pjcozzi 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
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
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
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
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
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
143 changes: 143 additions & 0 deletions
143
Apps/Sandcastle/gallery/development/BillboardClampToGround.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,143 @@ | ||
<!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="Clamp billboards to terrain."> | ||
<meta name="cesium-sandcastle-labels" content="Development"> | ||
<title>Cesium Demo</title> | ||
<script type="text/javascript" src="../Sandcastle-header.js"></script> | ||
<script type="text/javascript" src="../../../ThirdParty/requirejs-2.1.9/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); | ||
</style> | ||
<div id="cesiumContainer" class="fullSize"></div> | ||
<div id="loadingOverlay"><h1>Loading...</h1></div> | ||
<div id="toolbar"> | ||
<div id="terrainMenu"></div> | ||
<div id="zoomButtons"></div> | ||
<div id="toggleLighting"></div> | ||
<div id="sampleButtons"></div> | ||
</div> | ||
<script id="cesium_sandcastle_script"> | ||
function startup(Cesium) { | ||
"use strict"; | ||
//Sandcastle_Begin | ||
var viewer = new Cesium.Viewer('cesiumContainer'); | ||
|
||
var cesiumTerrainProviderMeshes = new Cesium.CesiumTerrainProvider({ | ||
url : '//assets.agi.com/stk-terrain/world' | ||
}); | ||
viewer.terrainProvider = cesiumTerrainProviderMeshes; | ||
viewer.scene.globe.depthTestAgainstTerrain = true; | ||
|
||
var ellipsoid = viewer.scene.globe.ellipsoid; | ||
var billboardCollection = viewer.scene.primitives.add(new Cesium.BillboardCollection({ | ||
scene : viewer.scene | ||
})); | ||
|
||
// seneca | ||
var centerLongitude = -1.385205433269729; | ||
var centerLatitude = 0.6777926580888163; | ||
|
||
var gridWidth = Math.floor(Math.random() * 100.0); | ||
var gridHeight = Math.floor(Math.random() * 100.0); | ||
var rectangleHalfSize = 0.0005; | ||
|
||
var e = new Cesium.Rectangle(centerLongitude - rectangleHalfSize, centerLatitude - rectangleHalfSize, centerLongitude + rectangleHalfSize, centerLatitude + rectangleHalfSize); | ||
|
||
for (var y = 0; y < gridHeight; ++y) { | ||
for (var x = 0; x < gridWidth; ++x) { | ||
var longitude = Cesium.Math.lerp(e.west, e.east, x / (gridWidth - 1)); | ||
var latitude = Cesium.Math.lerp(e.south, e.north, y / (gridHeight - 1)); | ||
var position = new Cesium.Cartographic(longitude, latitude); | ||
|
||
billboardCollection.add({ | ||
position : ellipsoid.cartographicToCartesian(position), | ||
image : '../images/facility.gif', | ||
heightReference : Cesium.HeightReference.CLAMP_TO_GROUND | ||
}); | ||
} | ||
} | ||
|
||
var billboard; | ||
|
||
Sandcastle.addToolbarButton('Add billboard', function() { | ||
if (!Cesium.defined(billboard)) { | ||
billboard = billboardCollection.add({ | ||
position : ellipsoid.cartographicToCartesian(new Cesium.Cartographic(centerLongitude, centerLatitude, 1000.0)), | ||
image : '../images/Cesium_Logo_overlay.png', | ||
scale : 0.7, | ||
heightReference : Cesium.HeightReference.RELATIVE_TO_GROUND | ||
}); | ||
} | ||
}); | ||
|
||
Sandcastle.addToolbarButton('Remove billboard', function() { | ||
if (Cesium.defined(billboard)) { | ||
billboardCollection.remove(billboard); | ||
billboard = undefined; | ||
} | ||
}); | ||
|
||
Sandcastle.addToolbarMenu([ { | ||
text : 'Relative to ground', | ||
onselect : function() { | ||
if (Cesium.defined(billboard)) { | ||
billboard.heightReference = Cesium.HeightReference.RELATIVE_TO_GROUND; | ||
} | ||
} | ||
}, { | ||
text : 'Clamp to ground', | ||
onselect : function() { | ||
if (Cesium.defined(billboard)) { | ||
billboard.heightReference = Cesium.HeightReference.CLAMP_TO_GROUND; | ||
} | ||
} | ||
}, { | ||
text : 'None', | ||
onselect : function() { | ||
if (Cesium.defined(billboard)) { | ||
billboard.heightReference = Cesium.HeightReference.NONE; | ||
} | ||
} | ||
}]); | ||
|
||
var lonGran = 0.00005; | ||
|
||
Sandcastle.addToolbarButton('Increase longitude', function() { | ||
if (Cesium.defined(billboard)) { | ||
var cartographic = ellipsoid.cartesianToCartographic(billboard.position); | ||
cartographic.longitude += lonGran; | ||
billboard.position = ellipsoid.cartographicToCartesian(cartographic); | ||
} | ||
}); | ||
|
||
Sandcastle.addToolbarButton('Decrease longitude', function() { | ||
if (Cesium.defined(billboard)) { | ||
var cartographic = ellipsoid.cartesianToCartographic(billboard.position); | ||
cartographic.longitude -= lonGran; | ||
billboard.position = ellipsoid.cartographicToCartesian(cartographic); | ||
} | ||
}); | ||
|
||
//Sandcastle_End | ||
Sandcastle.finishedLoading(); | ||
} | ||
if (typeof Cesium !== "undefined") { | ||
startup(Cesium); | ||
} else if (typeof require === "function") { | ||
require(["Cesium"], startup); | ||
} | ||
</script> | ||
</body> | ||
</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
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
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 |
---|---|---|
|
@@ -31,4 +31,4 @@ define([ | |
}; | ||
|
||
return freezeObject(PixelDatatype); | ||
}); | ||
}); |
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.
Any idea why we get negative altitudes right at the end of the model?
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.
Yup, its picking the depth plane. The regular pick to see if the model is under the mouse cursor checks a 3x3 pixel region. Picking the position only uses the center pixel.