Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

White sky when zooming out (ShowMySky) #3351

Closed
Atque opened this issue Aug 4, 2023 · 14 comments
Closed

White sky when zooming out (ShowMySky) #3351

Atque opened this issue Aug 4, 2023 · 14 comments
Assignees
Labels
bug Something likely wrong in the code
Milestone

Comments

@Atque
Copy link
Contributor

Atque commented Aug 4, 2023

Using the latest master, the sky turns completely white using SMS and showing certain points of the sky. It appears the anti-solar point is broken. Using an older calculation of the sky textures, shows no problem.

Introduced by efa6b05?

Windows 10 64-bit
Qt 6.4.2
AMD Radeon RX 5700 XT

@10110111
Copy link
Contributor

10110111 commented Aug 4, 2023

I don't reproduce this. Please give more detailed instructions, the log, and possibly screenshots or a screencast.

@Atque
Copy link
Contributor Author

Atque commented Aug 4, 2023

First it looks normal:
stellarium-243

But looking too far down, yields a white, broken atmosphere:
stellarium-244

Looking even further towards the nadir, Stellarium gets incredibly slow (0.2 FPS). Disabling atmosphere gives normal FPS rates.

Log:
log.txt

I fear this might be yet another AMD trouble?

Edit: Hmmm. ShowMySky works fine (no mie scattering below horizon), using the CMS master.
Edit II: Oh, no wait. There's a hole in the sky near nadir there as well :/

@gzotti
Copy link
Member

gzotti commented Aug 4, 2023

I had though this was solved by cmake/CPM magic: SMS not found on Windows. I had my SMS library from January. Is there a new version? Please add instructions to BUILDING.md.

@10110111
Copy link
Contributor

10110111 commented Aug 4, 2023

SMS not found on Windows

This is irrelevant to this issue.

@10110111
Copy link
Contributor

10110111 commented Aug 4, 2023

I fear this might be yet another AMD trouble?

May well be.

Edit: Hmmm. ShowMySky works fine (no mie scattering below horizon), using the CMS master.
Edit II: Oh, no wait. There's a hole in the sky near nadir there as well :/

Could you recompute the model via calcmysky adding --radiance argument to the command line, and show me the radiance spectrum of the broken nadir area?

@Atque
Copy link
Contributor Author

Atque commented Aug 4, 2023

Could you recompute the model via calcmysky adding --radiance argument to the command line, and show me the radiance spectrum of the broken nadir area?

This is the result:
bild

@10110111
Copy link
Contributor

10110111 commented Aug 4, 2023

OK, I suppose it may be a problem with the GPU implementation of tanh function. Normally it should yield 1.0 for large arguments, but maybe your GPU spits something inedible. What if you use the following patch for CalcMySky?

diff --git a/shaders/render.frag b/shaders/render.frag
index 7c264b6..5287267 100644
--- a/shaders/render.frag
+++ b/shaders/render.frag
@@ -125,7 +125,7 @@ void main()
         // forward scattering peak. The second factor, with tanh, makes the
         // transition near sunset from a bit above horizon to a bit below smoother.
         pseudoMirrorDepth = sqr(max(0, dot(viewDir, sunDirection))) *
-                               tanh(150 * (newViewElev - horizElev) / (PI/2 - horizElev));
+                               tanh(min(10, 150 * (newViewElev - horizElev) / (PI/2 - horizElev)));
     }
 
     CONST float cosSunZenithAngle =dot(zenith,sunDirection);

@10110111
Copy link
Contributor

10110111 commented Aug 4, 2023

(Note that to fully apply this patch, you need to regenerate the model.)

@Atque
Copy link
Contributor Author

Atque commented Aug 4, 2023

OK, I suppose it may be a problem with the GPU implementation of tanh function. Normally it should yield 1.0 for large arguments, but maybe your GPU spits something inedible. What if you use the following patch for CalcMySky?

diff --git a/shaders/render.frag b/shaders/render.frag
index 7c264b6..5287267 100644
--- a/shaders/render.frag
+++ b/shaders/render.frag
@@ -125,7 +125,7 @@ void main()
         // forward scattering peak. The second factor, with tanh, makes the
         // transition near sunset from a bit above horizon to a bit below smoother.
         pseudoMirrorDepth = sqr(max(0, dot(viewDir, sunDirection))) *
-                               tanh(150 * (newViewElev - horizElev) / (PI/2 - horizElev));
+                               tanh(min(10, 150 * (newViewElev - horizElev) / (PI/2 - horizElev)));
     }
 
     CONST float cosSunZenithAngle =dot(zenith,sunDirection);

I have never managed to build CMS from source (only used the stable releases or builds from Appveyor). Could you provide a binary?

@10110111
Copy link
Contributor

10110111 commented Aug 4, 2023

You can take an artifact from an AppVeyor build. Just apply the patch to the render.frag file you can find inside.

@Atque
Copy link
Contributor Author

Atque commented Aug 4, 2023

Oh yeah, of course, those can be altered after the build.

The fix you provided seems to have solved this. No more hole in the nadir area, and the area below the horizon looks better when Mie scattering is not mirrored:
stellarium-245

This is how it is supposed to look, right? If so, the issue can be closed.

@10110111
Copy link
Contributor

10110111 commented Aug 4, 2023

I'll push this fix, and the commit will close this issue.

@alex-w alex-w added this to Needs triage in OpenGL/GLSL via automation Aug 4, 2023
@alex-w alex-w added this to the 23.3 milestone Aug 4, 2023
@alex-w alex-w moved this from Needs triage to Done in OpenGL/GLSL Aug 4, 2023
@alex-w alex-w added the bug Something likely wrong in the code label Aug 4, 2023
@alex-w alex-w added this to Needs triage in Atmosphere via automation Aug 4, 2023
@alex-w alex-w moved this from Needs triage to Done in Atmosphere Aug 4, 2023
@alex-w alex-w added the state: published The fix has been published for testing in weekly binary package label Sep 2, 2023
@github-actions
Copy link

github-actions bot commented Sep 2, 2023

Hello @Atque!

Please check the fresh version (development snapshot) of Stellarium:
https://github.com/Stellarium/stellarium-data/releases/tag/weekly-snapshot

@alex-w alex-w removed the state: published The fix has been published for testing in weekly binary package label Sep 26, 2023
@github-actions
Copy link

Hello @Atque!

Please check the latest stable version of Stellarium:
https://github.com/Stellarium/stellarium/releases/latest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something likely wrong in the code
Projects
Atmosphere
  
Done
OpenGL/GLSL
  
Done
Development

No branches or pull requests

4 participants