Two fixes for yesterday commit, new Mist pass:
authorTon Roosendaal <ton@blender.org>
Sun, 20 Jan 2008 14:50:30 +0000 (14:50 +0000)
committerTon Roosendaal <ton@blender.org>
Sun, 20 Jan 2008 14:50:30 +0000 (14:50 +0000)
- non OSA case didn't work
- ztransp adding was accidentally using an incorrect alpha value

NOTE: allmost all pass types rendered in OSA with a filter (not box!) were
incorrectly added on solid layers. Like diffuse, AO, etc.

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

index dbe149115d9a6c9b33fd13d57fd15c05da57dcfa..e151151b0d21fa45749cbeadf0381c634984432b 100644 (file)
@@ -484,6 +484,10 @@ static void add_passes(RenderLayer *rl, int offset, ShadeInput *shi, ShadeResult
                                        *fp= (float)shi->obr->ob->index;
                                }
                                break;
+                       case SCE_PASS_MIST:
+                               fp= rpass->rect + offset;
+                               *fp= shr->mist;
+                               break;
                }
                if(col) {
                        fp= rpass->rect + pixsize*offset;
index 223653ddf0775e5a16b28afbb3820d754cce6f23..3779f2381028cc991e4b99681a45ab4283bdf6b6 100644 (file)
@@ -3790,6 +3790,7 @@ unsigned short *zbuffer_transp_shade(RenderPart *pa, RenderLayer *rl, float *pas
                                                add_transp_speed(rl, od, ssamp.shr[0].winspeed, pass[3], rdrect);
                                }
                                else {
+                                       float alpha= 0.0f;
                                        short filled, *sp= (short *)(ztramask+od);
                                        
                                        /* for each mask-sample we alpha-under colors. then in end it's added using filter */
@@ -3812,17 +3813,21 @@ unsigned short *zbuffer_transp_shade(RenderPart *pa, RenderLayer *rl, float *pas
                                                }
                                        }
                                        
+                                       /* note; cannot use pass[3] for alpha due to filtermask */
                                        for(a=0; a<R.osa; a++) {
                                                add_filt_fmask(1<<a, samp_shr[a].combined, pass, rr->rectx);
+                                               alpha+= samp_shr[a].combined[3];
                                        }
                                        
                                        if(addpassflag) {
+                                               alpha*= sampalpha;
+                                               
                                                /* merge all in one, and then add */
                                                merge_transp_passes(rl, samp_shr);
-                                               add_transp_passes(rl, od, samp_shr, pass[3]);
+                                               add_transp_passes(rl, od, samp_shr, alpha);
 
                                                if(addpassflag & SCE_PASS_VECTOR)
-                                                       add_transp_speed(rl, od, samp_shr[0].winspeed, pass[3], rdrect);
+                                                       add_transp_speed(rl, od, samp_shr[0].winspeed, alpha, rdrect);
                                        }
                                }
                        }