From 2c11523b39b8a47ce7bd2e7df9287cc7748d0745 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sat, 16 Feb 2008 18:49:54 +0000 Subject: [PATCH] Fix for bug #8285 and #8286: halo crashes with environment maps and render instancing. Fix for vector blur alpha blending bug due to my recent bugfix, as reported on bf-committers. --- .../render/intern/source/convertblender.c | 19 +++++++++++++++++++ source/blender/render/intern/source/envmap.c | 2 ++ source/blender/render/intern/source/zbuf.c | 4 ++-- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index c62a51c3566..c266e5eb107 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -4260,6 +4260,25 @@ static int allow_render_object(Object *ob, int nolamps, int onlyselected, Object static int allow_render_dupli_instance(Render *re, DupliObject *dob, Object *obd) { + ParticleSystem *psys; + Material ***material; + short a, *totmaterial; + + /* don't allow objects with halos */ + totmaterial= give_totcolp(obd); + material= give_matarar(obd); + + if(totmaterial && material) { + for(a= 0; a<*totmaterial; a++) + if((*material)[a]->mode & MA_HALO) + return 0; + } + + for(psys=obd->particlesystem.first; psys; psys=psys->next) + if(!ELEM5(psys->part->draw_as, PART_DRAW_BB, PART_DRAW_LINE, PART_DRAW_PATH, PART_DRAW_OB, PART_DRAW_GR)) + return 0; + + /* don't allow lamp, animated duplis, or radio render */ return (render_object_type(obd->type) && (!(dob->type == OB_DUPLIGROUP) || !dob->animated) && !(re->r.mode & R_RADIO)); diff --git a/source/blender/render/intern/source/envmap.c b/source/blender/render/intern/source/envmap.c index fd73fd7ab60..f556f482463 100644 --- a/source/blender/render/intern/source/envmap.c +++ b/source/blender/render/intern/source/envmap.c @@ -150,6 +150,7 @@ static Render *envmap_render_copy(Render *re, EnvMap *env) envre->tothalo= re->tothalo; envre->totstrand= re->totstrand; envre->totlamp= re->totlamp; + envre->sortedhalos= re->sortedhalos; envre->lights= re->lights; envre->objecttable= re->objecttable; envre->customdata_names= re->customdata_names; @@ -170,6 +171,7 @@ static void envmap_free_render_copy(Render *envre) envre->totstrand= 0; envre->totlamp= 0; envre->totinstance= 0; + envre->sortedhalos= NULL; envre->lights.first= envre->lights.last= NULL; envre->objecttable.first= envre->objecttable.last= NULL; envre->customdata_names.first= envre->customdata_names.last= NULL; diff --git a/source/blender/render/intern/source/zbuf.c b/source/blender/render/intern/source/zbuf.c index 84f69b03cda..e86fa5a5186 100644 --- a/source/blender/render/intern/source/zbuf.c +++ b/source/blender/render/intern/source/zbuf.c @@ -3184,8 +3184,8 @@ void RE_zbuf_accumulate_vecblur(NodeBlurData *nbd, int xsize, int ysize, float * /* accum */ for(dr= rectdraw, dz2=newrect, x= xsize*ysize-1; x>=0; x--, dr++, dz2+=4) { if(dr->colpoin) { - float bfac= dr->alpha*blendfac; - float mf= 1.0f - bfac*dr->colpoin[3]; + float bfac= dr->alpha*blendfac*dr->colpoin[3]; + float mf= 1.0f - bfac; dz2[0]= mf*dz2[0] + bfac*dr->colpoin[0]; dz2[1]= mf*dz2[1] + bfac*dr->colpoin[1];