// Cesium3DTile.js Cesium3DTile.prototype.getScreenSpaceError() Cesium3DTile.prototype.getScreenSpaceError = function ( frameState, useParentGeometricError, progressiveResolutionHeightFraction ) { var tileset = this._tileset; var heightFraction = defaultValue(progressiveResolutionHeightFraction, 1.0); var parentGeometricError = defined(this.parent) ? this.parent.geometricError : tileset._geometricError; var geometricError = useParentGeometricError ? parentGeometricError : this.geometricError; if (geometricError === 0.0) { // Leaf tiles do not have any error so save the computation return 0.0; } var camera = frameState.camera; var frustum = camera.frustum; var context = frameState.context; var width = context.drawingBufferWidth; var height = context.drawingBufferHeight * heightFraction; var error; if ( frameState.mode === SceneMode.SCENE2D || frustum instanceof OrthographicFrustum ) { if (defined(frustum._offCenterFrustum)) { frustum = frustum._offCenterFrustum; } var pixelSize = Math.max(frustum.top - frustum.bottom, frustum.right - frustum.left) / Math.max(width, height); error = geometricError / pixelSize; } else { // Avoid divide by zero when viewer is inside the tile var distance = Math.max(this._distanceToCamera, CesiumMath.EPSILON7); var sseDenominator = camera.frustum.sseDenominator; error = (geometricError * height) / (distance * sseDenominator); if (tileset.dynamicScreenSpaceError) { var density = tileset._dynamicScreenSpaceErrorComputedDensity; var factor = tileset.dynamicScreenSpaceErrorFactor; var dynamicError = CesiumMath.fog(distance, density) * factor; error -= dynamicError; } } error /= frameState.pixelRatio; return error; };
上述源碼是獲取當前 Tile
的屏幕空間偏差的,在這裏,能夠很直觀看出 幾何偏差 與 屏幕空間偏差 的關係。
屏幕空間偏差是指當前攝像機狀態下(若是是2D,那麼就是當前高度的視角下),實時計算出來的一個值
而幾何偏差,則用於計算當前狀態下的屏幕空間偏差,見這兩行:ide
error = geometricError / pixelSize;
error = (geometricError * height) / (distance * sseDenominator);
而具體的這個屏幕空間偏差的含義,待後續研究。this