-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Added HSB color adjustment to the atmosphere and a sandcastle demo #3971
Added HSB color adjustment to the atmosphere and a sandcastle demo #3971
Conversation
I made a small change to help with the sun-position based atmosphere mode. Computing luminance from the shifted color would obscure the night sky when the color shift increased brightness, so now the shader does luminance from the unshifted color. |
@@ -0,0 +1,108 @@ | |||
<!DOCTYPE html> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Sandcastle name is fine as just Atmosphere Color.html
. Some other things to add to this demo might be a fog enabled button (like http://localhost:8080/Apps/Sandcastle/index.html?src=Terrain.html&label=Showcases), and set a different initial view, such as a view like your screenshot.
That's all my comments right now. The Sandcastle demo is a really nice touch, it's looking good. |
Ah one more thing, make sure to add a test for this. Something simple like rendering the atmosphere normally, then rendering after changing the shifts, and checking that the resulting colors are different. |
@@ -27,6 +27,7 @@ Change Log | |||
* Added `Scene.nearToFarDistance2D` that determines the size of each frustum of the multifrustum in 2D. | |||
* Added support for rendering models in 2D and Columbus view. | |||
* Fixed a bug that was causing the atmosphere to disappear when only atmosphere is visible. [#3347](https://github.com/AnalyticalGraphicsInc/cesium/issues/3347) | |||
* Added support for hue, saturation, and brightness color shifts in the atmosphere in `SkyAtmosphere` [3439](https://github.com/AnalyticalGraphicsInc/cesium/issues/3439) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor, should be: #3439
.
Can you give @lilleyse and I commit access to your fork so we can make minor tweaks like this?
@likangning93 can you make a nice animated gif of this so we can tweet it? Use http://www.cockos.com/licecap/ and just paste it into a comment in this PR. |
I'm having some trouble writing the test case that @lilleyse suggested. Here's what I have right now:
I'm pretty sure the command for the skyAtmosphere is getting to the scene (when I console.log it from scene it's defined) but the last |
@likangning93 perhaps use a lower resolution but more bits or fps? I think it needs to be under 4MB for twitter. If it turns out to be too much work, just create a 2-4 screenshots and we'll attach those to a tweet. |
I think I streamlined the test some, but I'm still not sure if the
|
I'm basing this comment off of your previous code snippet: So I think the main problem with the previous code was that you were setting This code snippet worked for me: scene.skyAtmosphere = new SkyAtmosphere();
scene._environmentState.isReadyForAtmosphere = true;
scene.camera.setView({
destination : Cartesian3.fromDegrees(-75.5847, 40.0397, 1000.0),
orientation: {
heading : -CesiumMath.PI_OVER_TWO,
pitch : 0.2,
roll : 0.0
}
});
var color = scene.renderForSpecs();
expect(color).not.toEqual([0, 0, 0, 255]);
scene.skyAtmosphere.hueShift = 0.5;
var hueColor = scene.renderForSpecs();
expect(hueColor).not.toEqual([0, 0, 0, 255]);
expect(hueColor).not.toEqual(color); |
Actually I'm wrong that |
Awesome! Thanks Sean! Updated. |
@likangning93 that animated gif is perfect, thanks! I scheduled a tweet for next week when folks are back from vacation! |
Can we aim to merge this today so it can make the 1.23 release tomorrow? |
Updated, fixed a merge conflict in CHANGES.md. |
…ocumentation, added some shader defines, added a test case
6fda146
to
6b6b89e
Compare
* @type (Boolean) | ||
* @default false | ||
*/ | ||
this.colorCorrect = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of this variable it's easier to just check in update
that hue, saturation, or brightness are not 0.0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mainly this is just from a usability standpoint, the user doesn't need to know to turn on colorCorrect
first, it just works when changing hue, saturation, or brightness.
…color correction versions of the shaderse on demand.
Updated |
@@ -28,6 +28,7 @@ Change Log | |||
* Fixed issue where billboards on terrain didn't always update when the terrain provider was changed. [#3921](https://github.com/AnalyticalGraphicsInc/cesium/issues/3921) | |||
* Fixed issue where `Matrix4.fromCamera` was taking eye/target instead of position/direction. [#3927](https://github.com/AnalyticalGraphicsInc/cesium/issues/3927) | |||
* Added `Scene.nearToFarDistance2D` that determines the size of each frustum of the multifrustum in 2D. | |||
* Added support for hue, saturation, and brightness color shifts in the atmosphere in `SkyAtmosphere` [#3439](https://github.com/AnalyticalGraphicsInc/cesium/issues/3439) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also include a link to where the new Sandcastle example will be hosted, e.g., for 3D models, the link is http://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=3D%20Models.html&label=Showcases
Looking good! Just those comments from me. |
…better encapsulation, small optimization
Updated |
Looks good, thanks! @lilleyse can do the honor of merging when ready! |
Looks good to me too. |
Resolves #3439.
I added hue/saturation/brightness color adjustment to the atmosphere and a sandcastle demo for this.
Sean and I thought color post processing would be the best approach for adjusting the atmosphere color, and it seems like a lot of photo manipulation tools already have HSB color adjustment.
Also updated CHANGES.md.