diff options
author | Joshua Rahm <jrahm@Scipio.(none)> | 2014-04-22 02:58:19 -0600 |
---|---|---|
committer | Joshua Rahm <jrahm@Scipio.(none)> | 2014-04-22 02:58:19 -0600 |
commit | 4319bad3c312545e56c236a0515d1c1e9cdbf03d (patch) | |
tree | 5f9cbdeabab679b50b4f6c3658262004a3cb268e /shaders | |
parent | bc247b19550b58ce8e9f6ab82ac7607c8713de44 (diff) | |
download | terralloc-4319bad3c312545e56c236a0515d1c1e9cdbf03d.tar.gz terralloc-4319bad3c312545e56c236a0515d1c1e9cdbf03d.tar.bz2 terralloc-4319bad3c312545e56c236a0515d1c1e9cdbf03d.zip |
refined sun, added ability to grab input without full screening
Diffstat (limited to 'shaders')
-rw-r--r-- | shaders/sky.frag | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/shaders/sky.frag b/shaders/sky.frag index c81c8b0..6d47adb 100644 --- a/shaders/sky.frag +++ b/shaders/sky.frag @@ -13,17 +13,21 @@ uniform sampler2D night_tex ; in vec2 texcoord; in vec4 position ; +float exp1( float x ) { + return 2 / (1+exp(-x))-1; +} void main() { // the sun vec3 lighttofrag = vec3(position*10000000 - lightpos) ; vec3 lighttocamera = vec3(lightpos) ; - vec4 mul = vec4(vec3( sqrt(0.001 / (1 - dot(normalize(lighttocamera), normalize(lighttofrag))))), 1) ; - mul *= vec4(1.0,0.95,0.8,1.0) ; + float coef = 1 - dot(normalize(lighttocamera), normalize(lighttofrag)); + vec4 mul = vec4(vec3( pow(0.0005 / coef,0.8)), 1) ; + mul *= vec4(1.0,0.85,0.5,1.0) ; frag_color = mix(texture2D(night_tex,texcoord) * (1-globalAmbient.a), texture2D(texture,texcoord) * vec4(normalize(globalAmbient.xyz),1), - (globalAmbient.a + 1) / 2) ; - frag_color += mul ; + (globalAmbient.a + 1) / 2) * 1.8 ; + frag_color = frag_color + mul ; } |