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

Overlapping Imagery Layers Produce Black Tile Artifacts on Chrome and Firefox #7649

Closed
justin-lau opened this issue Mar 14, 2019 · 9 comments · Fixed by #7722
Closed

Overlapping Imagery Layers Produce Black Tile Artifacts on Chrome and Firefox #7649

justin-lau opened this issue Mar 14, 2019 · 9 comments · Fixed by #7722

Comments

@justin-lau
Copy link

When certain number of imagery layers overlaps (I used 15 in this demo). See it on sandcastle.

image

When an offset is applied to the layers, stopping them from overlapping, it renders correctly:
image

Tested on the following browsers

  • Chrome v72.0.3626.121 (64-bit) -> Reproducible
  • Firefox v65.0.1 (64-bit) -> Reproducible
  • Safari v12.0.3 (14606.4.5) -> Not Reproducible

Operating System: macOS Mojave 10.14.3
Tested and yield same result on multiple generation of iMacs, Macbook Air, and Macbook Pro.

@hpinkos
Copy link
Contributor

hpinkos commented Mar 14, 2019

Thanks for including the code example @justin-lau, I was able to reproduce this as well.

@likangning93
Copy link
Contributor

wonder if this is related to #7640

@shunter
Copy link
Contributor

shunter commented Mar 14, 2019

It's been a long time since I looked at any of the related code but this feels like it could be a result of exceeding the number of texture units, since we bind all overlapping imagery tiles for a terrain tile as separate textures. The iPad probably has a lower limit than a desktop card, so encounters the issue earlier. If my hypothesis holds, in the picture for this issue, it's not that they're overlapping, but rather in the second picture where it draws correctly, several of the images have been moved from the tile for eastern US to the western US tile, putting the eastern tile below the limit.

@likangning93
Copy link
Contributor

feels like it could be a result of exceeding the number of texture units

I think Cesium is supposed to get around this by breaking the imagery layers across more draw calls as necessary, but maybe something is going wrong with that.

More data:

  • unable to reproduce on Chrome 72 in Windows 10, GT750M via ANGLE, even with 128 iterations. http://webglreport.com/ indicates a limit of 16 texture image units in the fragment shader.
  • able to reproduce on Chrome 72 in Linux, Intel Bay Trail via Mesa DRI, with as few as 13 iterations (+ base imagery + black marble, so 15 layers that I'm aware of). Curiously, webglreport also indicates a limit of 16 texture image units in the fragment shader for this potato's-impression-of-a-gpu (said with endearment, not frustration)

@gastonmz
Copy link

wonder if this is related to #7640

yeah... seems to be the same issue

@likangning93
Copy link
Contributor

feels like it could be a result of exceeding the number of texture units

I think Cesium is supposed to get around this by breaking the imagery layers across more draw calls as necessary, but maybe something is going wrong with that.

Spitballing, maybe some commit added a batch table to globe tiles but didn't update GlobeSurfaceTileProvider to take this into account when figuring how many textures can be used in a draw call, and maybe some platforms (Nvidia + ANGLE?) are underreporting the number of texture units.
See https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/Scene/GlobeSurfaceTileProvider.js#L1555

@likangning93
Copy link
Contributor

likangning93 commented Apr 6, 2019

Able to confirm on Windows 10 + Intel (HD 4000) via ANGLE as well.

A little more narrowing down seems to point at https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/Shaders/GlobeFS.glsl#L106, having the function return something like texture2D(textureToSample, textureCoordinates) + previousColor instead of what it's actually doing seems to work as expected. I'll keep digging.

@likangning93
Copy link
Contributor

likangning93 commented Apr 8, 2019

Incidentally, can't reproduce on Windows 10 + HD 4000 in IE11.

@justin-lau I'm testing a fix here.

@justin-lau
Copy link
Author

Incidentally, can't reproduce on Windows 10 + HD 4000 in IE11.

@justin-lau I'm testing a fix here.

Thanks, @likangning93! Great investigation and fix!

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

Successfully merging a pull request may close this issue.

5 participants