aboutsummaryrefslogtreecommitdiff
path: root/shaders
diff options
context:
space:
mode:
Diffstat (limited to 'shaders')
-rw-r--r--shaders/earth.fp22
-rw-r--r--shaders/earth.vp1
2 files changed, 12 insertions, 11 deletions
diff --git a/shaders/earth.fp b/shaders/earth.fp
index c8d6d2a..3ca8ae9 100644
--- a/shaders/earth.fp
+++ b/shaders/earth.fp
@@ -5,6 +5,7 @@ uniform sampler2D tex;
varying vec3 fragmentNormal ;
varying vec3 lightVector ;
varying vec3 cameraVector ;
+uniform float time ;
void main()
{
@@ -14,23 +15,22 @@ void main()
float c = dot( fragNormal, normalize( cameraVector ) );
c = (c - 0.5) * 2.0 ;
- vec4 color = texture2D(tex,gl_TexCoord[0].xy + vec2( 0.5, -0.2 ));
-
- float bluef = (1.0f / (1.0f + exp(-f * 150.0f)));
+ vec4 color = texture2D(tex,gl_TexCoord[0].xy + vec2( -time, -0.2 ));
float bluef2 = (1.0f / (1.0f + exp(c * 20.0f))) * f;
- float redf2 = (1.0f / (1.0f + exp(c * 20.0f))) * pow(f,2) * f;
- float greenf2 = redf2;
+ float redf2 = 200.0 * (1.0f / (1.0f + exp(c * 20.0f))) * pow(f,10.0) * f;
+ float greenf2 = 200.0 * (1.0f / (1.0f + exp(c * 20.0f))) * pow(f,15.0) * f;
float alpha = (1.0f / (1.0f + exp(c * 30.0f))) * f;
/* Each color has its own drop off rate */
- float greenf = (1.0f / (1.0f + exp(-f * 60.0f)));
- float redf = (1.0f / (1.0f + exp(-f * 30.0f)));
+ float bluef = (0.8f / (1.0f + exp(-f * 100.0f)));
+ float greenf = (0.8f / (1.0f + exp(-f * 40.0f))) ;
+ float redf = (0.8f / (1.0f + exp(-f * 20.0f))) ;
gl_FragColor = vec4(
- redf*color[0] + 1000.0*redf2,
- greenf*color[1] + 1000.0*greenf2,
- bluef*color[2] + 1000.0*bluef2,
- 1.0-1000.0*alpha );
+ min(1.0,(redf*color[0] + 1000.0*redf2)),
+ min(1.0,(greenf*color[1] + 1000.0*greenf2)),
+ min(1.0,(bluef*color[2] + 1000.0*bluef2)),
+ min(1.0,1.0-1000.0*alpha) );
}
diff --git a/shaders/earth.vp b/shaders/earth.vp
index 502a970..31fc84b 100644
--- a/shaders/earth.vp
+++ b/shaders/earth.vp
@@ -3,6 +3,7 @@ uniform vec3 lightPos ;
/* Position of the -x axis */
uniform vec3 cameraPos ;
+uniform float time ;
varying vec3 fragmentNormal;
varying vec3 lightVector;