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

HDR Rendering #7017

Merged
merged 107 commits into from
Nov 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
a5ef38b
HDR WIP. Add Reinhard tonemapping. [ci skip]
bagnell May 19, 2018
f0ddfd8
Output sun texture to floating point texture.
bagnell May 21, 2018
6882ea6
Actually render to float texture. [ci skip]
bagnell May 21, 2018
1698aad
Bloom WIP. [ci skip].
bagnell May 22, 2018
e003b9e
Testing different blur.
bagnell May 22, 2018
0cd0862
Revert shaders. Use another bright pass filter WIP. [ci skip]
bagnell May 23, 2018
adbf667
Add different tonemappers WIP. [ci skip]
bagnell May 25, 2018
095c1af
Merge branch 'master' into hdr
bagnell Jun 7, 2018
7d48a5f
Fix after merge.
bagnell Jun 7, 2018
06d89eb
Merge branch 'master' into hdr
bagnell Jun 22, 2018
4d47dcc
Auto exposure WIP. [ci skip]
bagnell Jun 26, 2018
6496236
Gamma correction.
bagnell Jul 5, 2018
3b1fc7e
Auto exposure WIP. [ci skip]
bagnell Jul 6, 2018
7ebf78c
Auto exposure WIP. [ci skip]
bagnell Jul 9, 2018
2ac1f32
Fix auto exposure flicker. [ci skip]
bagnell Jul 9, 2018
6d59847
Merge branch 'master' into hdr
bagnell Jul 10, 2018
4386f78
Clean up.
bagnell Jul 10, 2018
8cf28a6
Modify tonemapping constants, globe, fog, and atmosphere
ggetz Jul 10, 2018
0b0b5d5
Merge branch 'master' into hdr
bagnell Jul 11, 2018
8aee74a
Tweak fog appearance"
ggetz Jul 13, 2018
c5124fe
Fix auto exposure decimation.
bagnell Jul 13, 2018
bf29856
Fix blend with previous frame luminance.
bagnell Jul 13, 2018
5992e84
Bloom WIP. [ci skip]
bagnell Jul 13, 2018
8c14a73
Correct gamma correction for glTF 2.0 models, billboards, and materia…
bagnell Jul 18, 2018
f815fe9
Fix remaining gamma correction issues.
bagnell Jul 19, 2018
a909eae
Merge branch 'master' into hdr
bagnell Jul 19, 2018
1cc7708
Modify sun lighting. Option to use camera as light source.
bagnell Jul 20, 2018
bfa7ee4
Tweak gamma to neutral and modify ACES values
ggetz Jul 20, 2018
8b1ac52
Better mapping constants, sun color is white-blue
ggetz Jul 23, 2018
4d1188f
Merge branch 'master' into hdr
bagnell Aug 2, 2018
8667a71
Merge branch 'atmosphere' into hdr-atmosphere
bagnell Aug 2, 2018
d851ce5
Fix after merge.
bagnell Aug 3, 2018
95bb621
Merge branch 'atmosphere' into hdr-atmosphere
bagnell Aug 9, 2018
ad648f3
Compute the atmosphere color per-fragment for smoother night-day tran…
bagnell Aug 20, 2018
33a7b40
Merge branch 'master' into hdr
bagnell Aug 20, 2018
5794f95
Merge branch 'atmosphere' into hdr-atmosphere
bagnell Aug 20, 2018
ea441c4
Merge branch 'hdr' into hdr-atmosphere
bagnell Aug 20, 2018
17efa5a
Merge branch 'float-linear' into hdr
bagnell Aug 20, 2018
187e8cb
Merge branch 'hdr' into hdr-atmosphere
bagnell Aug 20, 2018
37a4e00
Merge branch 'master' into hdr
bagnell Aug 29, 2018
97d31b8
Merge branch 'hdr' into hdr-atmosphere
bagnell Aug 29, 2018
e8ffa88
Merge branch 'atmosphere' into hdr-atmosphere
bagnell Aug 29, 2018
09a791b
Merge branch 'float-linear' into hdr
bagnell Aug 29, 2018
da3bce1
Add ability to change the tonemapping operator, but keep it private f…
bagnell Aug 29, 2018
2d888fe
Switch back to using half-floats.
bagnell Aug 29, 2018
129e50e
Clean up auto-exposure usage.
bagnell Aug 29, 2018
1e2bcd3
Revert bloom changes for now. [ci skip]
bagnell Aug 29, 2018
2bb0043
Add doc. [ci skip]
bagnell Aug 30, 2018
6056feb
Merge branch 'remove-deprecated-fxaa' into hdr
bagnell Aug 30, 2018
51e8523
Fix sun extending beyond texture.
bagnell Aug 30, 2018
9353d45
Use half-floats when supported.
bagnell Aug 30, 2018
a6f2e72
Add flag for HDR (need to modify shaders). Clean up phong lighting.
bagnell Aug 30, 2018
84ecd4b
Clean up shaders.
bagnell Aug 31, 2018
1dc42bc
Add HDR derived commands to add an HDR define when supported. Otherwi…
bagnell Aug 31, 2018
9e39ad8
Fix gamma correction when HDR is disabled.
bagnell Sep 5, 2018
b9c9073
Pass globe eye position when HDR enabled.
bagnell Sep 5, 2018
effe4d7
Merge branch 'master' into hdr
bagnell Sep 5, 2018
6a6ca8a
Update CHANGES.md after merge.
bagnell Sep 5, 2018
dd357da
Merge branch 'atmosphere' into hdr
bagnell Sep 5, 2018
132b933
Fix some tests and a copy-paste error.
bagnell Sep 5, 2018
bc0856d
Merge branch 'atmosphere' into hdr
bagnell Sep 6, 2018
bbde12b
Fix after merge.
bagnell Sep 6, 2018
2dbfe37
More fixes after merge.
bagnell Sep 6, 2018
42ad8d9
Updates for derived command from scene re-work.
bagnell Sep 6, 2018
fb5d165
Merge branch 'master' into hdr
bagnell Oct 4, 2018
5a0802f
Fixes after merge.
bagnell Oct 4, 2018
fb950f8
Updates from review.
bagnell Oct 4, 2018
ec4712b
Merge branch 'master' into hdr
bagnell Oct 17, 2018
0fcf8c5
Fix gamma correction for PerInstanceColorAppearance.
bagnell Oct 17, 2018
594a9b4
Fix some issues with gamma correction.
bagnell Oct 17, 2018
998f3e2
Fix glTF 1.0 model gamma correction.
bagnell Oct 18, 2018
209ec90
Fix globe day/night shading.
bagnell Oct 18, 2018
260c0e6
Fix point cloud gamma correction.
bagnell Oct 18, 2018
f72afd3
Update imagery contrast.
bagnell Oct 18, 2018
4d911f8
Fix background color gamma correction.
bagnell Oct 18, 2018
7cada27
Fix shadows and a typo.
bagnell Oct 18, 2018
d4ca95f
Merge branch 'master' into hdr
bagnell Oct 18, 2018
b0541b0
Fix picking and another typo.
bagnell Oct 18, 2018
b8144a9
Fix tests.
bagnell Oct 18, 2018
7b011f1
Fix DOF.
bagnell Oct 19, 2018
faf1904
Update doc.
bagnell Oct 19, 2018
4051515
Merge branch 'master' into hdr
bagnell Oct 19, 2018
15dbe1e
Fix typo after merge.
bagnell Oct 19, 2018
2066481
Merge branch 'master' into hdr
bagnell Oct 22, 2018
0019163
Make czm_sunColor a Cartesian3.
bagnell Oct 22, 2018
bd5cb7f
Add automatic uniforms tests.
bagnell Oct 22, 2018
aeb9abd
Fix toggling HDR.
bagnell Oct 22, 2018
8d0f552
Fix crash when toggling HDR because globe tile resources were destroyed.
bagnell Oct 22, 2018
6dac90e
Add tonemapping tests and an HDR test.
bagnell Oct 23, 2018
2741e35
Merge branch 'master' into hdr
bagnell Oct 24, 2018
55bfbe3
Fix test.
bagnell Oct 24, 2018
44d53e5
Fix failing WebGL stub test.
bagnell Oct 24, 2018
c33ad4b
Merge branch 'master' into hdr
bagnell Oct 24, 2018
fba7324
Fix gamma correct for billboard color.
bagnell Oct 30, 2018
6184f61
Gamma correct 3D Tiles styling color.
bagnell Oct 30, 2018
25efa79
Fix composite material example.
bagnell Oct 30, 2018
fa12020
Merge branch 'master' into hdr
bagnell Nov 2, 2018
f82229a
Update CHANGES.md.
bagnell Nov 2, 2018
3088019
Globe HDR visual tweaks
lilleyse Nov 7, 2018
c6cb009
Merge branch 'master' into hdr
bagnell Nov 7, 2018
a98c9c6
Merge branch 'master' into hdr
lilleyse Nov 8, 2018
4c33a68
Fix gamma correction on some 3D Tiles.
bagnell Nov 8, 2018
6f27325
Fix IE crash by removing const expression.
bagnell Nov 8, 2018
8492d35
Update for models with KHR_techniques_webgl from review.
bagnell Nov 12, 2018
171ccb2
Update from review.
bagnell Nov 13, 2018
7a062bc
Fix issue with cached glTFs.
bagnell Nov 14, 2018
ac63b95
Fix extra gamma correct.
bagnell Nov 14, 2018
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
24 changes: 14 additions & 10 deletions Apps/Sandcastle/gallery/Materials.html
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,20 @@
}
},
source :
'czm_material czm_getMaterial(czm_materialInput materialInput) {' +
'czm_material material = czm_getDefaultMaterial(materialInput);' +
'float heightValue = texture2D(heightField, materialInput.st).r;' +
'material.diffuse = mix(vec3(0.2, 0.6, 0.2), vec3(1.0, 0.5, 0.2), heightValue);' +
'material.alpha = (1.0 - texture2D(image, materialInput.st).r) * 0.7;' +
'material.normal = bumpMap.normal;' +
'material.specular = step(0.1, heightValue);' + // Specular mountain tops
'material.shininess = 8.0;' + // Sharpen highlight
'return material;' +
'}'
'czm_material czm_getMaterial(czm_materialInput materialInput) { \n' +
' czm_material material = czm_getDefaultMaterial(materialInput); \n' +
' vec4 color; \n' +
' float heightValue = texture2D(heightField, materialInput.st).r; \n' +
' color.rgb = mix(vec3(0.2, 0.6, 0.2), vec3(1.0, 0.5, 0.2), heightValue); \n' +
' color.a = (1.0 - texture2D(image, materialInput.st).r) * 0.7; \n' +
' color = czm_gammaCorrect(color); \n' +
' material.diffuse = color.rgb; \n' +
' material.alpha = color.a; \n' +
' material.normal = bumpMap.normal; \n' +
' material.specular = step(0.1, heightValue); \n' + // Specular mountain tops
' material.shininess = 8.0; \n' + // Sharpen highlight
' return material; \n' +
'} \n'
}
});
}
Expand Down
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Change Log
* Added functions to get the most detailed height of 3D Tiles on-screen or off-screen. [#7115](https://github.com/AnalyticalGraphicsInc/cesium/pull/7115)
* Added `Scene.sampleHeightMostDetailed`, an asynchronous version of `Scene.sampleHeight` that uses the maximum level of detail for 3D Tiles.
* Added `Scene.clampToHeightMostDetailed`, an asynchronous version of `Scene.clampToHeight` that uses the maximum level of detail for 3D Tiles.
* Added support for high dynamic range rendering. It is enabled by default when supported, but can be disabled with `Scene.highDynamicRange`. [#7017](https://github.com/AnalyticalGraphicsInc/cesium/pull/7017)
* Added `Scene.invertClassificationSupported` for checking if invert classification is supported.
* Added `computeLineSegmentLineSegmentIntersection` to `Intersections2D`. [#7228](https://github.com/AnalyticalGraphicsInc/Cesium/pull/7228)

Expand Down
28 changes: 28 additions & 0 deletions Source/Renderer/AutomaticUniforms.js
Original file line number Diff line number Diff line change
Expand Up @@ -1686,6 +1686,34 @@ define([
getValue : function(uniformState) {
return uniformState.invertClassificationColor;
}
}),

/**
* An automatic GLSL uniform that is used for gamma correction.
*
* @alias czm_gamma
* @glslUniform
*/
czm_gamma : new AutomaticUniform({
size : 1,
datatype : WebGLConstants.FLOAT,
getValue : function(uniformState) {
return uniformState.gamma;
}
}),

/**
* An automatic GLSL uniform that defines the color of light emitted by the sun.
*
* @alias czm_sunColor
* @glslUniform
*/
czm_sunColor: new AutomaticUniform({
size: 1,
datatype: WebGLConstants.FLOAT_VEC3,
getValue: function(uniformState) {
return uniformState.sunColor;
}
})
};

Expand Down
17 changes: 17 additions & 0 deletions Source/Renderer/UniformState.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ define([
* @type {Texture}
*/
this.globeDepthTexture = undefined;
/**
* @type {Number}
*/
this.gamma = undefined;

this._viewport = new BoundingRectangle();
this._viewportCartesian4 = new Cartesian4();
Expand Down Expand Up @@ -143,6 +147,7 @@ define([
this._sunPositionColumbusView = new Cartesian3();
this._sunDirectionWC = new Cartesian3();
this._sunDirectionEC = new Cartesian3();
this._sunColor = new Cartesian3();
this._moonDirectionEC = new Cartesian3();

this._pass = undefined;
Expand Down Expand Up @@ -737,6 +742,17 @@ define([
}
},

/**
* The color of the light emitted by the sun.
* @memberof UniformState.prototype
* @type {Color}
*/
sunColor: {
get: function() {
return this._sunColor;
}
},

/**
* A normalized vector to the moon in eye coordinates at the current scene time. In 3D mode, this
* returns the actual vector from the camera position to the moon position. In 2D and Columbus View, it returns
Expand Down Expand Up @@ -1069,6 +1085,7 @@ define([
}

setSunAndMoonDirections(this, frameState);
this._sunColor = Cartesian3.clone(frameState.sunColor, this._sunColor);

var brdfLutGenerator = frameState.brdfLutGenerator;
var brdfLut = defined(brdfLutGenerator) ? brdfLutGenerator.colorTexture : undefined;
Expand Down
Loading