forked from bartvdbraak/blender
Fix #33505: various issues
* Motion blur with shutter time > 1 did result in the correct evaluation of some modifiers because it set the subframe to values > 1, and some places assume the current frame to be set to the integer coordinate and the subframe to be a value between 0 and 1. * Shape keys did not take subframe time offsets into account. * Point density texture was using an current frame value that was never set.
This commit is contained in:
parent
cfd6282a80
commit
593ae2c8f4
@ -1078,7 +1078,7 @@ static void do_mesh_key(Scene *scene, Object *ob, Key *key, char *out, const int
|
||||
if (key->slurph && key->type != KEY_RELATIVE) {
|
||||
const float ctime_scaled = key->ctime / 100.0f;
|
||||
float delta = (float)key->slurph / tot;
|
||||
float cfra = (float)scene->r.cfra;
|
||||
float cfra = (float)scene->r.cfra + scene->r.subframe;
|
||||
int step, a;
|
||||
|
||||
if (tot > 100 && slurph_opt) {
|
||||
@ -1176,7 +1176,7 @@ static void do_curve_key(Scene *scene, Object *ob, Key *key, char *out, const in
|
||||
if (key->slurph && key->type != KEY_RELATIVE) {
|
||||
const float ctime_scaled = key->ctime / 100.0f;
|
||||
float delta = (float)key->slurph / tot;
|
||||
float cfra = (float)scene->r.cfra;
|
||||
float cfra = (float)scene->r.cfra + scene->r.subframe;
|
||||
Nurb *nu;
|
||||
int i = 0, remain = 0;
|
||||
int step, a;
|
||||
@ -1258,7 +1258,7 @@ static void do_latt_key(Scene *scene, Object *ob, Key *key, char *out, const int
|
||||
if (key->slurph && key->type != KEY_RELATIVE) {
|
||||
const float ctime_scaled = key->ctime / 100.0f;
|
||||
float delta = (float)key->slurph / tot;
|
||||
float cfra = (float)scene->r.cfra;
|
||||
float cfra = (float)scene->r.cfra + scene->r.subframe;
|
||||
int a;
|
||||
|
||||
for (a = 0; a < tot; a++, cfra += delta) {
|
||||
@ -1373,7 +1373,7 @@ float *do_ob_key(Scene *scene, Object *ob)
|
||||
}
|
||||
else {
|
||||
/* do shapekey local drivers */
|
||||
float ctime = (float)scene->r.cfra; // XXX this needs to be checked
|
||||
float ctime = (float)scene->r.cfra + scene->r.subframe;
|
||||
|
||||
BKE_animsys_evaluate_animdata(scene, &key->id, key->adt, ctime, ADT_RECALC_DRIVERS);
|
||||
|
||||
|
@ -198,7 +198,6 @@ struct Render
|
||||
ListBase strandsurface;
|
||||
|
||||
/* use this instead of R.r.cfra */
|
||||
float cfra;
|
||||
float mblur_offs, field_offs;
|
||||
|
||||
/* render database */
|
||||
|
@ -942,6 +942,9 @@ void RE_TileProcessor(Render *re)
|
||||
|
||||
static void do_render_3d(Render *re)
|
||||
{
|
||||
float cfra;
|
||||
int cfra_backup;
|
||||
|
||||
/* try external */
|
||||
if (RE_engine_render(re, 0))
|
||||
return;
|
||||
@ -949,9 +952,13 @@ static void do_render_3d(Render *re)
|
||||
/* internal */
|
||||
RE_parts_clamp(re);
|
||||
|
||||
// re->cfra= cfra; /* <- unused! */
|
||||
re->scene->r.subframe = re->mblur_offs + re->field_offs;
|
||||
|
||||
/* add motion blur and fields offset to frames */
|
||||
cfra_backup = re->scene->r.cfra;
|
||||
|
||||
cfra = re->scene->r.cfra + re->mblur_offs + re->field_offs;
|
||||
re->scene->r.cfra = floorf(cfra);
|
||||
re->scene->r.subframe = cfra - floorf(cfra);
|
||||
|
||||
/* lock drawing in UI during data phase */
|
||||
if (re->draw_lock)
|
||||
re->draw_lock(re->dlh, 1);
|
||||
@ -976,6 +983,7 @@ static void do_render_3d(Render *re)
|
||||
/* free all render verts etc */
|
||||
RE_Database_Free(re);
|
||||
|
||||
re->scene->r.cfra = cfra_backup;
|
||||
re->scene->r.subframe = 0.f;
|
||||
}
|
||||
|
||||
|
@ -447,7 +447,7 @@ int pointdensitytex(Tex *tex, const float texvec[3], TexResult *texres)
|
||||
turb = BLI_gTurbulence(pd->noise_size, texvec[0]+age, texvec[1]+age, texvec[2]+age, pd->noise_depth, 0, pd->noise_basis);
|
||||
}
|
||||
else if (pd->noise_influence == TEX_PD_NOISE_TIME) {
|
||||
time = R.cfra / (float)R.r.efra;
|
||||
time = R.r.cfra / (float)R.r.efra;
|
||||
turb = BLI_gTurbulence(pd->noise_size, texvec[0]+time, texvec[1]+time, texvec[2]+time, pd->noise_depth, 0, pd->noise_basis);
|
||||
//turb = BLI_turbulence(pd->noise_size, texvec[0]+time, texvec[1]+time, texvec[2]+time, pd->noise_depth);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user