aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Rahm <jrahm@cambrian>2013-12-12 02:42:05 -0700
committerJoshua Rahm <jrahm@cambrian>2013-12-12 02:42:05 -0700
commit82cb0595848a0e9b1fbea0fef695cff859f45c5a (patch)
tree55deae0ddc0e6b3d2d4955c36660a32da44f8f0b
parent66816ca528ef0434cc2f013fc966d9355e722393 (diff)
downloadSonsOfSol-82cb0595848a0e9b1fbea0fef695cff859f45c5a.tar.gz
SonsOfSol-82cb0595848a0e9b1fbea0fef695cff859f45c5a.tar.bz2
SonsOfSol-82cb0595848a0e9b1fbea0fef695cff859f45c5a.zip
fixed shader for NVIDIA card
-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)) );
}