Fix [#21874] Sun/ Sky breaks when sun is in the night rotation
authorMatt Ebb <matt@mke3.net>
Fri, 2 Apr 2010 01:28:14 +0000 (01:28 +0000)
committerMatt Ebb <matt@mke3.net>
Fri, 2 Apr 2010 01:28:14 +0000 (01:28 +0000)
Disable atmosphere when the sun lamp direction is below the horizon. This
feature needs a re-code...

source/blender/render/intern/source/rendercore.c

index fbb390c..047bbd7 100644 (file)
@@ -739,10 +739,15 @@ static void atm_tile(RenderPart *pa, RenderLayer *rl)
                                                if(*zrect >= 9.9e10 || rgbrect[3]==0.0f) {
                                                        continue;
                                                }
-                                               
+                                                                                               
                                                if((lar->sunsky->effect_type & LA_SUN_EFFECT_AP)) {     
                                                        float tmp_rgb[3];
                                                        
+                                                       /* skip if worldspace lamp vector is below horizon */
+                                                       if(go->ob->obmat[2][2] < 0.f) {
+                                                               continue;
+                                                       }
+                                                       
                                                        VECCOPY(tmp_rgb, rgbrect);
                                                        if(rgbrect[3]!=1.0f) {  /* de-premul */
                                                                float div= 1.0f/rgbrect[3];