forked from CesiumGS/cesium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ability to change atmosphere color CesiumGS#3439
Change the atmoshphere color
- Loading branch information
Showing
2 changed files
with
33 additions
and
19 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,11 +2,11 @@ | |
* @license | ||
* Copyright (c) 2000-2005, Sean O'Neil ([email protected]) | ||
* All rights reserved. | ||
* | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions | ||
* are met: | ||
* | ||
* | ||
* * Redistributions of source code must retain the above copyright notice, | ||
* this list of conditions and the following disclaimer. | ||
* * Redistributions in binary form must reproduce the above copyright notice, | ||
|
@@ -15,7 +15,7 @@ | |
* * Neither the name of the project nor the names of its contributors may be | ||
* used to endorse or promote products derived from this software without | ||
* specific prior written permission. | ||
* | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
|
@@ -29,10 +29,10 @@ | |
* | ||
* Modifications made by Analytical Graphics, Inc. | ||
*/ | ||
|
||
// Code: http://sponeil.net/ | ||
// GPU Gems 2 Article: http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter16.html | ||
|
||
attribute vec4 position; | ||
|
||
uniform float fCameraHeight; | ||
|
@@ -43,6 +43,9 @@ uniform float fInnerRadius; // The inner (planetary) radius | |
uniform float fScale; // 1 / (fOuterRadius - fInnerRadius) | ||
uniform float fScaleDepth; // The scale depth (i.e. the altitude at which the atmosphere's average density is found) | ||
uniform float fScaleOverScaleDepth; // fScale / fScaleDepth | ||
uniform float fRedColor; // The atmosphere color's red compoenent | ||
uniform float fGreenColor; // The atmosphere color's green compoenent | ||
uniform float fBlueColor; // The atmosphere color's blue compoenent | ||
|
||
const float Kr = 0.0025; | ||
const float fKr4PI = Kr * 4.0 * czm_pi; | ||
|
@@ -51,12 +54,9 @@ const float fKm4PI = Km * 4.0 * czm_pi; | |
const float ESun = 15.0; | ||
const float fKmESun = Km * ESun; | ||
const float fKrESun = Kr * ESun; | ||
const vec3 v3InvWavelength = vec3( | ||
5.60204474633241, // Red = 1.0 / Math.pow(0.650, 4.0) | ||
9.473284437923038, // Green = 1.0 / Math.pow(0.570, 4.0) | ||
19.643802610477206); // Blue = 1.0 / Math.pow(0.475, 4.0) | ||
|
||
const float rayleighScaleDepth = 0.25; | ||
|
||
const int nSamples = 2; | ||
const float fSamples = 2.0; | ||
|
||
|
@@ -105,6 +105,7 @@ void main(void) | |
float fScaledLength = fSampleLength * fScale; | ||
vec3 v3SampleRay = v3Ray * fSampleLength; | ||
vec3 v3SamplePoint = v3Start + v3SampleRay * 0.5; | ||
vec3 v3InvWavelength = vec3(fRedColor / pow(0.650, 4.0), fGreenColor / pow(0.570, 4.0), fBlueColor / pow(0.475, 4.0)); | ||
|
||
// Now loop through the sample rays | ||
vec3 v3FrontColor = vec3(0.0, 0.0, 0.0); | ||
|