Created
September 8, 2020 13:25
-
-
Save addam/2deef12fcf5a529fb7de8980d449649d to your computer and use it in GitHub Desktop.
get world coordinates in Cesium
This file contains hidden or 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
vec4 world() { | |
vec4 ndc = vec4( | |
2.0 * (gl_FragCoord.xy - czm_viewport.xy) / czm_viewport.zw - 1.0, | |
(czm_readDepth(depthTexture, v_textureCoordinates) - czm_viewportTransformation[3][2]) / czm_viewportTransformation[2][2], | |
1.0); | |
vec4 eye = czm_inverseProjection * ndc; | |
return czm_inverseView * eye; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment