fix for glitch with vertex bake:

- the mesh would be tagged to update, then updated before bake finished.
- also increase self-shadow offset, in some cases the offset wasn't enough.
This commit is contained in:
Campbell Barton 2013-01-23 04:22:02 +00:00
parent c8dbf61f35
commit 7c4f70178f
2 changed files with 7 additions and 5 deletions

@ -667,10 +667,12 @@ static void RE_rayobject_octree_done(RayObject *tree)
oc->ocface = NULL;
MEM_freeN(oc->ro_nodes);
oc->ro_nodes = NULL;
#if 0
printf("%f %f - %f\n", oc->min[0], oc->max[0], oc->ocfacx);
printf("%f %f - %f\n", oc->min[1], oc->max[1], oc->ocfacy);
printf("%f %f - %f\n", oc->min[2], oc->max[2], oc->ocfacz);
#endif
}
static void RE_rayobject_octree_bb(RayObject *tree, float *min, float *max)

@ -2433,7 +2433,7 @@ static void do_bake_shade(void *handle, int x, int y, float u, float v)
/* avoid self shadow with vertex bake from adjacent faces [#33729] */
if ((bs->vcol != NULL) && (bs->actob == NULL)) {
madd_v3_v3fl(shi->co, vlr->n, 0.00001f);
madd_v3_v3fl(shi->co, vlr->n, 0.0001f);
}
if (obi->flag & R_TRANSFORMED)
@ -2568,9 +2568,6 @@ static int get_next_bake_face(BakeShade *bs)
bs->mpoly = me->mpoly + *origindex;
bs->vcol = ((MLoopCol*)cdl->data) + bs->mpoly->loopstart;
bs->mloop = me->mloop + bs->mpoly->loopstart;
/* Tag mesh for reevaluation. */
DAG_id_tag_update(&me->id, 0);
}
else {
Image *ima = NULL;
@ -2660,6 +2657,9 @@ static void bake_single_vertex(BakeShade *bs, VertRen *vert, float u, float v)
bs->vcol = basevcol;
break;
}
/* needs to be done during baking and not before else the mesh will update before bake starts */
DAG_id_tag_update(&bs->obi->ob->id, OB_RECALC_DATA);
}
/* Bake all vertices of a face. Actually, this still works on a face-by-face