-
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
Add ground atmosphere and day/night shading to Model and 3D Tiles #11765
Closed
Closed
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
22475c7
Start adding ground atmosphere to frag shader
ptrgags 056edbf
proof-of-concept for 3D Tiles ground atmosphere
ptrgags 3e2f70d
Turn fog back on
ptrgags e024596
Merge branch '11716-visualize-fog' into 11717-model-ground-atmosphere
ptrgags 98e2475
camera height is an invariant
ptrgags da5f1c6
Add showGroundAtmosphere flag
ptrgags ac17ec4
Add u_perFragmentGroundAtmosphere
ptrgags ca08ba9
Merge branch '11716-visualize-fog' into 11717-model-ground-atmosphere
ptrgags 49e4629
Make combined FadeRange parameters
ptrgags 9f191d9
Add more details from GlobeFS
ptrgags 90c77bc
Fix typo
ptrgags 8c5b3f2
Start updating specs
ptrgags 8e56a2b
Remove debugging code
ptrgags bcd17d8
Merge branch 'main' into 11717-model-ground-atmosphere
ptrgags d16adbe
Fix some specs
ptrgags 0204185
Update changelog
ptrgags 20deb0b
Add an example for turning off ground atmosphere
ptrgags 136b411
Self-review feedback
ptrgags 5102970
Fix sunlight test
ptrgags File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
import Cartesian2 from "../Core/Cartesian2.js"; | ||
import Cartesian3 from "../Core/Cartesian3.js"; | ||
import DynamicAtmosphereLightingType from "./DynamicAtmosphereLightingType.js"; | ||
|
||
|
@@ -31,6 +32,10 @@ import DynamicAtmosphereLightingType from "./DynamicAtmosphereLightingType.js"; | |
* scene.atmosphere.brightnessShift = 0.25; // Increase the brightness | ||
* scene.atmosphere.saturationShift = -0.1; // Desaturate the colors | ||
* | ||
* @example | ||
* // Turn off ground atmosphere | ||
* scene.atmosphere.showGroundAtmosphere = false; | ||
* | ||
* @see SkyAtmosphere | ||
* @see Globe | ||
* @see Fog | ||
|
@@ -115,13 +120,61 @@ function Atmosphere() { | |
this.brightnessShift = 0.0; | ||
|
||
/** | ||
* When not DynamicAtmosphereLightingType.NONE, the selected light source will | ||
* When not {@link DynamicAtmosphereLightingType.NONE}, the selected light source will | ||
* be used for dynamically lighting all atmosphere-related rendering effects. | ||
* | ||
* @type {DynamicAtmosphereLightingType} | ||
* @default DynamicAtmosphereLightingType.NONE | ||
*/ | ||
this.dynamicLighting = DynamicAtmosphereLightingType.NONE; | ||
|
||
/** | ||
* The range of camera distances <code>[startDist, endDist]</code> | ||
* between which ground atmosphere lighting fades in. When the camera is at or | ||
* below startDist, no ground atmosphere lighting is applied. When the camera | ||
* is at or above endDist,the lighting is at maximum intensity. | ||
* <p> | ||
* Ground atmosphere lighting only applies when {@link Atmosphere#showGroundAtmosphere} | ||
* is <code>true.</code> | ||
* </p> | ||
* <p> | ||
* Camera distances are measured from the center of the earth in meters. | ||
* </p> | ||
* | ||
* @type {Cartesian2} | ||
* @default Cartesian2(1.0e7, 2.0e7) | ||
*/ | ||
this.lightingFadeRange = new Cartesian2(1.0e7, 2.0e7); | ||
/** | ||
* The range of camera distances <code>[startDist, endDist]</code> | ||
* between which nighttime shading fades in. When the camera is at or below | ||
* startDist, the entire globe is lit at full brightness. When the camera is | ||
* at or above endDist, the side of the globe facing away from the sun | ||
* will be in total darkness. | ||
* <p> | ||
* Nighttime shading only applies when {@link Atmosphere#showGroundAtmosphere} | ||
* is <code>true</code>, and {@link Atmosphere#dynamicLighting} is not {@link DynamicAtmosphereLightingType.NONE}. | ||
* </p> | ||
* <p> | ||
* Camera distances are measured from the center of the earth in meters. | ||
* </p> | ||
* | ||
* @type {Cartesian2} | ||
* @default Cartesian2(5.0e7, 1.0e7) | ||
*/ | ||
this.nightFadeRange = new Cartesian2(1.0e7, 5.0e7); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similarly, this is a rephrasing of |
||
|
||
/** | ||
* Enable the ground atmosphere for 3D Tiles and models. The ground atmosphere | ||
* is drawn over the globe when viewed from a distance between | ||
* <code>lightingFadeInDistance</code> and <code>lightingFadeOutDistance</code>. | ||
* The ground atmosphere makes the globe's surface appear brighter near the | ||
* edges when viewed from space. | ||
* | ||
* @type {boolean} | ||
* @default true | ||
*/ | ||
this.showGroundAtmosphere = true; | ||
} | ||
|
||
export default Atmosphere; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Note to @ggetz and @jjhembd: this parameter is a rephrasing of the confusingly-named parameters [
globe.lightingFadeOutDistance, globe.lightingFadeInDistance
], I figured this way would be easier to explain to users.