Skip to content

Commit

Permalink
Cesium.vue: improve underwater rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
Williangalvani committed Nov 22, 2021
1 parent 84e0892 commit 4da2401
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions src/components/CesiumViewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,18 @@ export default {
-48.52971476731231 + xofs, -27.49044182943895)
}))
this.viewer.scene.globe.translucency.frontFaceAlphaByDistance = new NearFarScalar(
400.0,
0.5,
800.0,
50.0,
0.4,
150.0,
1.0
)
this.viewer.scene.globe.undergroundColorAlphaByDistance.near = 0
this.viewer.scene.globe.undergroundColorAlphaByDistance.far = 10000
this.viewer.scene.globe.undergroundColorAlphaByDistance.nearValue = 0
this.viewer.scene.globe.undergroundColorAlphaByDistance.farValue = 1
this.viewer.scene.globe.translucency.enabled = true
this.viewer.scene.screenSpaceCameraController.enableCollisionDetection = false
this.viewer.scene.globe.undergroundColor = Color.MIDNIGHTBLUE
this.viewer.scene.globe.undergroundColorAlphaByDistance.near = 2
this.viewer.scene.globe.undergroundColorAlphaByDistance.far = 10
this.viewer.scene.globe.undergroundColorAlphaByDistance.nearValue = 0.2
this.viewer.scene.globe.undergroundColorAlphaByDistance.farValue = 1.0
}
this.addCloseButton()
Expand Down Expand Up @@ -325,16 +328,10 @@ export default {
let altitude = height - updatedPositions[0].height
const globe = this.viewer.scene.globe
if (altitude < 0) {
globe.showGroundAtmosphere = false
globe.showGroundAtmosphere = true
globe.translucency.enabled = true
globe.translucency.frontFaceAlpha = 0.7
globe.baseColor = Color.TRANSPARENT
} else {
globe.showGroundAtmosphere = true
globe.baseColor = Color.BLUE
globe.translucency.enabled = false
globe.translucency.frontFaceAlpha = 1.0
globe.undergroundColor = Color.BLACK
}
})
},
Expand Down

0 comments on commit 4da2401

Please sign in to comment.