-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
ImageryLayer Gamma calculations are wrong #7707
Comments
I noticed this during a recent Cesium upgrade to one of my projects. Also, @MattPetry reported this to me this morning. In both cases, the "Natural Earth II" imagery is the default, with some custom saturation & gamma settings for style. Playing with the gamma slider in the 1.53 demo, set to Natural Earth II, you can see that if the slider is exactly at 1.0 it looks correct, but if you move even one pixel in either direction, the image changes radically. There should not be a discontinuity like that at 1.0. Really the correct behavior is shown in 1.52. |
Also, there are some strong indicators of what's happened here. The "fast" approximation for converting between linear and sRGB color spaces uses a power of 2.2, such as:
The reverse of that uses power of So I'm thinking that in 1.53 and later, if the user sets a gamma value to anything other than exactly 1.0, then the software assumes that the user is somehow responsible for doing the gamma conversion to get themselves back into sRGB space at the end of the shader. This seems incorrect to me, as the colorspace conversion should be happening independently of (and in addition to) the user's artistic gamma correction settings. The other controls seem less impacted, but I think they are applying their effects in sRGB space now instead of applying them in linear space. I guess that's OK, except that it was an unannounced breaking change. The gamma behavior is not OK, though. |
Compare behavior between the Adjustment demo in 1.52 and 1.53. You will have to switch to a different baselayer, per #7706. The Gamma slider in 1.52 makes the image slightly darker when moved to the left (say, 0.9) and slightly lighter when moved to the right (say, 1.1). In 1.53, any value over about 0.5 makes the image lighter, except 1.0 exactly, which behaves as you'd expect it to. Experimentally, 0.45 looks almost identical to 1.0.
Something introduced in 1.53 must have changed the calculation for gamma, and it no longer behaves as intended.
The text was updated successfully, but these errors were encountered: