aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--shaders/earth.fp14
1 files changed, 10 insertions, 4 deletions
diff --git a/shaders/earth.fp b/shaders/earth.fp
index 3ca8ae9..7fd662c 100644
--- a/shaders/earth.fp
+++ b/shaders/earth.fp
@@ -17,9 +17,15 @@ void main()
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 = 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 bluef2 = 0.0f;
+ float redf2 = 0.0f;
+ float greenf2 = 0.0f;
+
+ if( f > 0 ) {
+ bluef2 = (1.0f / (1.0f + exp(c * 20.0f))) * f;
+ redf2 = 200.0 * (1.0f / (1.0f + exp(c * 20.0f))) * pow(f,10.0) * f;
+ 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;
@@ -32,5 +38,5 @@ void main()
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) );
+ min(1.0,max(1.0-1000.0*alpha,0.0)) );
}