CesiumGS / CesiumGS/cesium

maximumScreenSpaceError a bad metric for 3D Tiles

Open
#4,043 5 comments 0 reactions 0 assignees View on GitHub
category - 3d tiles
Dominant language
JavaScript
Stars
15.7k
Forks
3.9k
Avg merge
4d 6h
Merged PRs (30d)
34

Description

I spoke with both @lilleyse and @bagnell about this offline and Sean asked me to submit an issue.

`maximumScreenSpaceError` does not work very well as a metric for tile selection because it doesn't take into account the size of the Cesium canvas being drawn too, i.e. the same camera view will create wildly different images depending on the size of the window. Instead of absolute pixel size, perhaps this can be better represented as a percentage of pixels of the overall canvas?

I took a quick stab at illustrating this with the below Sandcastle example. If you resize the width of the window, you'll notice the view stays much more consistent than the current behavior.

``` javascript
var viewer = new Cesium.Viewer('cesiumContainer', {
scene3DOnly : true,
shadows : true
});

var scene = viewer.scene;
scene.fog.enabled = false;
scene.debugShowFramesPerSecond = true;

var tileset = scene.primitives.add(new Cesium.Cesium3DTileset({
url : 'https://cesiumjs.org/NewYork/3DTilesGml/tileset.json'
}));

Cesium.when(tileset.readyPromise)
.then(function(tileset) {
var boundingSphere = tileset.boundingSphere;
viewer.camera.viewBoundingSphere(boundingSphere, new Cesium.HeadingPitchRange(0, -2.0, 0));
viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
});

var lastWidth;
scene.preRender.addEventListener(function(){
var maximumScreenSpacePercentage = 0.01;

var width = scene.canvas.clientWidth;
if(lastWidth !== width){
var maximumScreenSpaceError = maximumScreenSpacePercentage * width;
lastWidth = width;
console.log(maximumScreenSpaceError);
console.log(width);
tileset.maximumScreenSpaceError = maximumScreenSpaceError;
}
});
```

CC @pjcozzi

Contributor guide

Open the contributing guide

Research direction

Start with the Sandcastle example in the issue and compare Cesium3DTileset.maximumScreenSpaceError while resizing the canvas. Review the proposed maximumScreenSpacePercentage calculation and determine the intended behavior across canvas widths; this issue does not identify an implementation file, test, or settled design, so completion criteria require maintainer agreement.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
computer-graphics
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.