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

shader cos/sin precision affecting rendering #2110

Closed
fstoner opened this issue Sep 2, 2014 · 4 comments
Closed

shader cos/sin precision affecting rendering #2110

fstoner opened this issue Sep 2, 2014 · 4 comments

Comments

@fstoner
Copy link
Contributor

fstoner commented Sep 2, 2014

Low precision in the implementation of the glsl cos/sin functions causes some distortions as seen in the following 2D capture. The coastline shows a discontinuity around the middle (top-to-bottom) of the image.

image

Specifically, the use of the "sin" function in czm_latitudeToWebMercatorFraction seems to be the problem.

If you zoom in to a sufficient level, the transformation is assumed to be linear and the discontinuity does not appear.

@fstoner
Copy link
Contributor Author

fstoner commented Sep 2, 2014

For testing, the above image is of http://en.wikipedia.org/wiki/Iturup island to the North-East of Hokkaido.

@pjcozzi pjcozzi closed this as completed Oct 6, 2014
@kring
Copy link
Member

kring commented Nov 13, 2014

@fstoner can you tell me any more about how to reproduce this? What hardware/browser it happened on for example? Even with DISABLE_CORDIC I can't seem to reproduce it.

@kring
Copy link
Member

kring commented Nov 13, 2014

Nevermind, I can reproduce it on an Intel HD4600 GPU in Chrome on Windows.

@kring
Copy link
Member

kring commented Nov 13, 2014

So it appears to me - correct me if I'm wrong - that the sin function on this Intel GPU is just completely broken. I understand that the standard does not guarantee any particular precision, and I would expect that to manifest as "flat spots" where small changes in x don't impact the output of sin(x). But this is much worse than that. In a region where sin(x) should be monotonically increasing, small changes in x result in sin(x) increasing for a bit, then decreasing just for fun, and then getting back to increasing.

GPUs make me very sad.

Given this kind of garbage from the GPU, the only solution I see is to compute the texture coordinates on the CPU, at least on GPUs with instruction limits that are too low to handle the cordic approach (and I still have no idea how to detect those GPUs).

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

No branches or pull requests

3 participants