HDR: gracefully handle situations where the viewer is below the ground
This commit is contained in:
parent
9b9ae5cf38
commit
760db3ba6d
2 changed files with 2 additions and 2 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue