diff options
| author | Joshua Rahm <joshua.rahm@colorado.edu> | 2013-12-11 02:39:59 -0700 |
|---|---|---|
| committer | Joshua Rahm <joshua.rahm@colorado.edu> | 2013-12-11 02:39:59 -0700 |
| commit | 678a0d1e4c97349ae2d29b4bdda8d670ce2490cf (patch) | |
| tree | f5b8b21b2f1baf803c03a8e247e18c918af5d0cd /shaders | |
| parent | 2e297229c65eeb6ec899a6f77bd333c7abc331e4 (diff) | |
| download | SonsOfSol-678a0d1e4c97349ae2d29b4bdda8d670ce2490cf.tar.gz SonsOfSol-678a0d1e4c97349ae2d29b4bdda8d670ce2490cf.tar.bz2 SonsOfSol-678a0d1e4c97349ae2d29b4bdda8d670ce2490cf.zip | |
Made shader look awesome, added readme, ready for final commit
Diffstat (limited to 'shaders')
| -rw-r--r-- | shaders/earth.fp | 22 | ||||
| -rw-r--r-- | shaders/earth.vp | 1 |
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; |