Skip to content

Commit

Permalink
Merge pull request #7431 from AnalyticalGraphicsInc/fix-bg-alpha
Browse files Browse the repository at this point in the history
Fix transparent background colors with HDR.
  • Loading branch information
lilleyse authored Dec 19, 2018
2 parents 700bbb8 + b805604 commit 845c94d
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Change Log
##### Fixes :wrench:
* Fixed 3D Tiles visibility checking when running multiple passes within the same frame. [#7289](https://github.com/AnalyticalGraphicsInc/cesium/pull/7289)
* Fixed contrast on imagery layers. [#7382](https://github.com/AnalyticalGraphicsInc/cesium/issues/7382)
* Fixed rendering transparent background color when `highDynamicRange` is enabled. [#7427](https://github.com/AnalyticalGraphicsInc/cesium/issues/7427)

### 1.52 - 2018-12-03

Expand Down
5 changes: 3 additions & 2 deletions Source/Shaders/PostProcessStages/AcesTonemapping.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ uniform sampler2D autoExposure;

void main()
{
vec3 color = texture2D(colorTexture, v_textureCoordinates).rgb;
vec4 fragmentColor = texture2D(colorTexture, v_textureCoordinates);
vec3 color = fragmentColor.rgb;

#ifdef AUTO_EXPOSURE
color /= texture2D(autoExposure, vec2(0.5)).r;
Expand All @@ -27,5 +28,5 @@ void main()

color = clamp(color, 0.0, 1.0);
color = czm_inverseGamma(color);
gl_FragColor = vec4(color, 1.0);
gl_FragColor = vec4(color, fragmentColor.a);
}
5 changes: 3 additions & 2 deletions Source/Shaders/PostProcessStages/FilmicTonemapping.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ uniform sampler2D autoExposure;

void main()
{
vec3 color = texture2D(colorTexture, v_textureCoordinates).rgb;
vec4 fragmentColor = texture2D(colorTexture, v_textureCoordinates);
vec3 color = fragmentColor.rgb;

#ifdef AUTO_EXPOSURE
float exposure = texture2D(autoExposure, vec2(0.5)).r;
Expand All @@ -31,5 +32,5 @@ void main()
float w = ((white * (A * white + C * B) + D * E) / (white * ( A * white + B) + D * F)) - E / F;

c = czm_inverseGamma(c / w);
gl_FragColor = vec4(c, 1.0);
gl_FragColor = vec4(c, fragmentColor.a);
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ uniform sampler2D autoExposure;

void main()
{
vec3 color = texture2D(colorTexture, v_textureCoordinates).rgb;
vec4 fragmentColor = texture2D(colorTexture, v_textureCoordinates);
vec3 color = fragmentColor.rgb;
#ifdef AUTO_EXPOSURE
float exposure = texture2D(autoExposure, vec2(0.5)).r;
color /= exposure;
#endif
color = (color * (1.0 + color / white)) / (1.0 + color);
color = czm_inverseGamma(color);
gl_FragColor = vec4(color, 1.0);
gl_FragColor = vec4(color, fragmentColor.a);
}
5 changes: 3 additions & 2 deletions Source/Shaders/PostProcessStages/ReinhardTonemapping.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ uniform sampler2D autoExposure;

void main()
{
vec3 color = texture2D(colorTexture, v_textureCoordinates).rgb;
vec4 fragmentColor = texture2D(colorTexture, v_textureCoordinates);
vec3 color = fragmentColor.rgb;
#ifdef AUTO_EXPOSURE
float exposure = texture2D(autoExposure, vec2(0.5)).r;
color /= exposure;
#endif
color = color / (1.0 + color);
color = czm_inverseGamma(color);
gl_FragColor = vec4(color, 1.0);
gl_FragColor = vec4(color, fragmentColor.a);
}

0 comments on commit 845c94d

Please sign in to comment.