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

Disable HDR by Default #8055

Merged
merged 11 commits into from
Aug 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ Change Log
##### Additions :tada:
* Added optional `index` parameter to `PrimitiveCollection.add`. [#8041](https://github.com/AnalyticalGraphicsInc/cesium/pull/8041)

##### Fixes :wrench:
Disabled HDR by default to improve visual quality in most standard use cases. Set `viewer.scene.highDynamicRange = true` to re-enable it. [#7966](https://github.com/AnalyticalGraphicsInc/cesium/issues/7966)

### 1.60 - 2019-08-01

##### Additions :tada:
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu
* [Hannah Pinkos](https://github.com/hpinkos)
* [Kangning Li](https://github.com/likangning93)
* [Sean Lilley](https://github.com/lilleyse)

* [Brandon Barker](https://github.com/ProjectBarks)

## [Individual CLA](Documentation/Contributors/CLAs/individual-contributor-license-agreement-v1.0.pdf)
* [Victor Berchet](https://github.com/vicb)
Expand Down
2 changes: 1 addition & 1 deletion Source/Scene/PostProcessStageLibrary.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ define([
'../Core/deprecationWarning',
'../Core/destroyObject',
'../Core/Ellipsoid',
'../Shaders/PostProcessStages/AcesTonemapping',
'../Shaders/PostProcessStages/AcesTonemappingStage',
'../Shaders/PostProcessStages/AmbientOcclusionGenerate',
'../Shaders/PostProcessStages/AmbientOcclusionModulate',
'../Shaders/PostProcessStages/BlackAndWhite',
Expand Down
2 changes: 1 addition & 1 deletion Source/Scene/Scene.js
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@ define([

this._hdr = undefined;
this._hdrDirty = undefined;
this.highDynamicRange = true;
this.highDynamicRange = false;
this.gamma = 2.2;
this._sunColor = new Cartesian3(1.8, 1.85, 2.0);

Expand Down
3 changes: 2 additions & 1 deletion Source/Scene/processPbrMaterials.js
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ define([
'vec3 LINEARtoSRGB(vec3 linearIn) \n' +
'{\n' +
'#ifndef HDR \n' +
' return pow(linearIn, vec3(1.0/2.2));\n' +
' return pow(czm_acesTonemapping(linearIn), vec3(1.0/2.2));\n' +
'#else \n' +
' return linearIn;\n' +
'#endif \n' +
Expand Down Expand Up @@ -869,6 +869,7 @@ define([
} else {
fragmentShader += ' gl_FragColor = vec4(color, 1.0);\n';
}

fragmentShader += '}\n';

// Add shaders
Expand Down
16 changes: 16 additions & 0 deletions Source/Shaders/Builtin/Functions/acesTonemapping.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// See:
// https://knarkowicz.wordpress.com/2016/01/06/aces-filmic-tone-mapping-curve/

vec3 czm_acesTonemapping(vec3 color) {
float g = 0.985;
float a = 0.065;
float b = 0.0001;
float c = 0.433;
float d = 0.238;

color = (color * (color + a) - b) / (color * (g * color + c) + d);

color = clamp(color, 0.0, 1.0);

return color;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ varying vec2 v_textureCoordinates;
uniform sampler2D autoExposure;
#endif

// See:
// https://knarkowicz.wordpress.com/2016/01/06/aces-filmic-tone-mapping-curve/

void main()
{
vec4 fragmentColor = texture2D(colorTexture, v_textureCoordinates);
Expand All @@ -17,16 +14,8 @@ void main()
#ifdef AUTO_EXPOSURE
color /= texture2D(autoExposure, vec2(0.5)).r;
#endif
float g = 0.985;

float a = 0.065;
float b = 0.0001;
float c = 0.433;
float d = 0.238;

color = (color * (color + a) - b) / (color * (g * color + c) + d);

color = clamp(color, 0.0, 1.0);
color = czm_acesTonemapping(color);
color = czm_inverseGamma(color);

gl_FragColor = vec4(color, fragmentColor.a);
}