From 82cb0595848a0e9b1fbea0fef695cff859f45c5a Mon Sep 17 00:00:00 2001 From: Joshua Rahm Date: Thu, 12 Dec 2013 02:42:05 -0700 Subject: fixed shader for NVIDIA card --- shaders/earth.fp | 14 ++++++++++---- 1 file 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)) ); } -- cgit