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

A rendering bug with globe at specific camera angles #12288

Open
lukemckinstry opened this issue Nov 5, 2024 · 6 comments
Open

A rendering bug with globe at specific camera angles #12288

lukemckinstry opened this issue Nov 5, 2024 · 6 comments

Comments

@lukemckinstry
Copy link
Contributor

lukemckinstry commented Nov 5, 2024

What happened?

In Cesium Scene, there is no imagery layer in the scene, the blue surface is the original earth surface, but you can still see the alternating dark on the surface.

It was clearly visible, grainy noise in the blue area. And this noise “moved” randomly when moving the camera - it looked like some sort of “screen space” effect. It was only visible in a very narrow are of the camera configuration (i.e. it disappeared quickly when moving up/down).

So it looks like it is related to the GraphicsCard/Driver (or, less likely, the OS).

Reported on the forum

image

Reproduction steps

  1. Sandcastle https://sandcastle.cesium.com/#c=bZLNbuIwFIVfxWIVJGri/4RS1IpZjZBmMdWs2BhzC1YdGzkOFVP13ccBKjIz9Sq+9zv3OMc2wbcJHS28QUQPyMMbWkJruwb/OteK9cic98vgk7Ye4no0vl/7iwLbRu8gnlb6BLHFEZpwhCfnigHSGvCAdy5sAIPXGwcru9sn63fZL8UObqhxwbxi08UIPj3bBv4+0ffOWe2/6QQF5bKUpJqomlQcM1EpLpSkigyMjW4gavziTs+heF97lNcW2uyskw1+Nhy91DHlL+1ZcQH7dUdFTaWscckE7Z0om9y6gteCS4GlJEoQoapBj9RVXZISMyoryTiT6tIbX5kQbf7D8zHQDL3fhHvQ2z6ZGeKYM8IqxoVUtKqVGIw/2GT2mbkrMcnuZSlIzXlOgHM6wGJwLlMlLksqGFVcVZxRWkkh+IX6uNLbLl4zKXPlY3w/mozmbTo5WHyOe7TNIcSEuugKjKcJmoPLN9FON515hYRN2/bZ9+h8OpTOt/aI7Pbhi4eEjNNtmzsvnXM/7W9Yjxbzaeb/k7pwzuXHEaLTpx7bk8XqUsQYz6d5+7UyheA2Ov4z+Q8

...

Sandcastle example

No response

Environment

Observed

Browser: Google Chrome 130.0.6723.59
CesiumJS Version:Cesium 1.123
Operating System:Windows 10 Professional 22H2 19045.5011
Graphics Card/Driver: ....

Not observed

Browser: Google Chrome 128.0.6613.137
CesiumJS Version:Cesium 1.123
Operating System: Ubuntu 22.04
Graphics Card/Driver: TU117M [GeForce GTX 1650 Mobile / Max-Q] NVIDIA Corporation

@javagl
Copy link
Contributor

javagl commented Nov 6, 2024

Observed:

Browser: Google Chrome 130.0.6723.92
CesiumJS version 1.123
Operating System: Windows 10, version 10.0.19045
Graphics Card: NVIDIA GeForce RTX 2070 SUPER, Driver version 32.0.15.6094

Not observed:

Browser: Google Chrome 130.0.6723.93
CesiumJS version 1.123
Operating System: Windows 11 Pro, version 10.0.22631
Graphics Card: AMD Radeon, Driver version 31.0.21024.5005

And for those who can not observe it and are curious: This is a GIF (256 colors), but it still adequately reflects the visual appearance of that "noise" in the blue area (which should basically be a single, solid color), and shows that it completely disappears when rotating the camera up or down, showing that the effect is only visible in a very narrow area.

Cesium Forum 36313 Camera Angle Noise

And more specifically, it looks like it is related to the sun being (more or less exactly) at the horizon - I just captured a sunset here:

Cesium Forum 36313 Camera Angle Noise Sunset

(This might give a hint about which part of the shader might have some if (dot(a, b) < epsilon) return black; that could cause this...)

@ggetz
Copy link
Contributor

ggetz commented Nov 8, 2024

Perhaps this is due to fog? Could someone who is able to reproduce the issue try it with:

// Disable fog in the scene
viewer.scene.fog.enabled = false;

and report what you see?

@ggetz ggetz added the needs feedback On hold until additional info is supplied label Nov 8, 2024
@javagl
Copy link
Contributor

javagl commented Nov 8, 2024

That fixes it (for me).

(Coming up with that idea, though 😲 ...)

@ggetz ggetz removed the needs feedback On hold until additional info is supplied label Nov 8, 2024
@ggetz
Copy link
Contributor

ggetz commented Nov 8, 2024

This may be in the same area of the code that is making fog too dark in general. My guess is there's some sort of precision issue.

@javagl
Copy link
Contributor

javagl commented Nov 8, 2024

Yes, a precision issue together with something like the if (dot(a, b) < epsilon) return black; that I mentioned. But...

  • it clearly depends on the sun being at the horizon
    (Yeah, maybe that's the point where the rays are just so cutting 'nearly horizonally' though the fog, but still...)
  • there is no visible fog before and after that narrow sunset-range

So the fact that it seems to be related to fog is ... surprising...

@javagl
Copy link
Contributor

javagl commented Nov 8, 2024

Now, I was a bit curious...

I'd say that the "dot product" that I mentioned is the one at

float darken = clamp(dot(normalize(czm_viewerPositionWC), atmosphereLightDirection), u_minimumBrightness, 1.0);
(or the analogous one in AtmosphereStageFS.glsl). It uses the viewer position and light direction, and that dot product may just so be near the limit when looking at the sun...

Setting
viewer.scene.fog.minimumBrightness = 0.0;
(which is what arrives as the u_minimumBrightness in that line) causes the noise to disappear.

When commenting out all uses of u_minimumBrightness, the noise still appears. In theory, this is not possible, but practice obviously doesn't care about that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants