1
0
Fork 0

HDR: gracefully handle situations where the viewer is below the ground

This commit is contained in:
Fernando García Liñán 2021-07-28 11:37:33 +02:00
parent 9b9ae5cf38
commit 760db3ba6d
2 changed files with 2 additions and 2 deletions

View file

@ -60,7 +60,7 @@ void main()
vec3 rayDir = vec4(fg_ViewMatrixInverse * vec4(normalize(fragPos), 0.0)).xyz;
float cameraHeight = length(fg_CameraPositionCart);
float earthRadius = cameraHeight - fg_CameraPositionGeod.z;
float earthRadius = cameraHeight - max(fg_CameraPositionGeod.z, 0.0);
vec3 rayOrigin = fg_CameraPositionCart;

View file

@ -49,7 +49,7 @@ void main()
vec3 rayDir = vec3(cos(elev) * cos(azimuth), cos(elev) * sin(azimuth), sin(elev));
float cameraHeight = length(fg_CameraPositionCart);
float earthRadius = cameraHeight - fg_CameraPositionGeod.z;
float earthRadius = cameraHeight - max(fg_CameraPositionGeod.z, 0.0);
vec3 rayOrigin = vec3(0.0, 0.0, cameraHeight);