aboutsummaryrefslogtreecommitdiff
path: root/shaders/sky.frag
diff options
context:
space:
mode:
Diffstat (limited to 'shaders/sky.frag')
-rw-r--r--shaders/sky.frag12
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 ;
}