Skip to content

Commit 845c94d

Browse files
authored
Merge pull request #7431 from AnalyticalGraphicsInc/fix-bg-alpha
Fix transparent background colors with HDR.
2 parents 700bbb8 + b805604 commit 845c94d

File tree

5 files changed

+13
-8
lines changed

5 files changed

+13
-8
lines changed

CHANGES.md

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Change Log
1313
##### Fixes :wrench:
1414
* Fixed 3D Tiles visibility checking when running multiple passes within the same frame. [#7289](https://github.com/AnalyticalGraphicsInc/cesium/pull/7289)
1515
* Fixed contrast on imagery layers. [#7382](https://github.com/AnalyticalGraphicsInc/cesium/issues/7382)
16+
* Fixed rendering transparent background color when `highDynamicRange` is enabled. [#7427](https://github.com/AnalyticalGraphicsInc/cesium/issues/7427)
1617

1718
### 1.52 - 2018-12-03
1819

Source/Shaders/PostProcessStages/AcesTonemapping.glsl

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ uniform sampler2D autoExposure;
1111

1212
void main()
1313
{
14-
vec3 color = texture2D(colorTexture, v_textureCoordinates).rgb;
14+
vec4 fragmentColor = texture2D(colorTexture, v_textureCoordinates);
15+
vec3 color = fragmentColor.rgb;
1516

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

2829
color = clamp(color, 0.0, 1.0);
2930
color = czm_inverseGamma(color);
30-
gl_FragColor = vec4(color, 1.0);
31+
gl_FragColor = vec4(color, fragmentColor.a);
3132
}

Source/Shaders/PostProcessStages/FilmicTonemapping.glsl

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ uniform sampler2D autoExposure;
1111

1212
void main()
1313
{
14-
vec3 color = texture2D(colorTexture, v_textureCoordinates).rgb;
14+
vec4 fragmentColor = texture2D(colorTexture, v_textureCoordinates);
15+
vec3 color = fragmentColor.rgb;
1516

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

3334
c = czm_inverseGamma(c / w);
34-
gl_FragColor = vec4(c, 1.0);
35+
gl_FragColor = vec4(c, fragmentColor.a);
3536
}

Source/Shaders/PostProcessStages/ModifiedReinhardTonemapping.glsl

+3-2
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@ uniform sampler2D autoExposure;
1212

1313
void main()
1414
{
15-
vec3 color = texture2D(colorTexture, v_textureCoordinates).rgb;
15+
vec4 fragmentColor = texture2D(colorTexture, v_textureCoordinates);
16+
vec3 color = fragmentColor.rgb;
1617
#ifdef AUTO_EXPOSURE
1718
float exposure = texture2D(autoExposure, vec2(0.5)).r;
1819
color /= exposure;
1920
#endif
2021
color = (color * (1.0 + color / white)) / (1.0 + color);
2122
color = czm_inverseGamma(color);
22-
gl_FragColor = vec4(color, 1.0);
23+
gl_FragColor = vec4(color, fragmentColor.a);
2324
}

Source/Shaders/PostProcessStages/ReinhardTonemapping.glsl

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@ uniform sampler2D autoExposure;
1111

1212
void main()
1313
{
14-
vec3 color = texture2D(colorTexture, v_textureCoordinates).rgb;
14+
vec4 fragmentColor = texture2D(colorTexture, v_textureCoordinates);
15+
vec3 color = fragmentColor.rgb;
1516
#ifdef AUTO_EXPOSURE
1617
float exposure = texture2D(autoExposure, vec2(0.5)).r;
1718
color /= exposure;
1819
#endif
1920
color = color / (1.0 + color);
2021
color = czm_inverseGamma(color);
21-
gl_FragColor = vec4(color, 1.0);
22+
gl_FragColor = vec4(color, fragmentColor.a);
2223
}

0 commit comments

Comments
 (0)