Fix T58492: smoke flow jitters around flow source when using adaptive domain.

This is more like a band-aid than a real fix actually, real fix would be
to understand why rendering smoke requires auto texspace to be ON
(afaict, this was not the case in 2.7x)...

But I've already spent way too much time on this issue, at least now we
get better situation than before (i.e. smoke with adaptive domain works
well even when orig domain mesh has autospace flag disabled).
This commit is contained in:
Bastien Montagne 2019-01-22 21:49:38 +01:00
parent 7886db9ba9
commit 3891ad8e03
Notes: blender-bot 2024-03-25 12:30:38 +01:00
Referenced by commit 1036ae2acd, Fix T58492: Removes jitter when using adaptive smoke domains
Referenced by issue #58492, smoke flow jitters around flow source when using adaptive domain
2 changed files with 13 additions and 3 deletions

View File

@ -2052,7 +2052,11 @@ static void mesh_build_data(
#endif
BKE_object_boundbox_calc_from_mesh(ob, ob->runtime.mesh_eval);
BKE_mesh_texspace_copy_from_object(ob->runtime.mesh_eval, ob);
/* Only copy texspace from orig mesh if some modifier (hint: smoke sim, see T58492)
* did not re-enable that flag (which always get disabled for eval mesh as a start). */
if (!(ob->runtime.mesh_eval->texflag & ME_AUTOSPACE)) {
BKE_mesh_texspace_copy_from_object(ob->runtime.mesh_eval, ob);
}
mesh_finalize_eval(ob);

View File

@ -2898,15 +2898,21 @@ struct Mesh *smokeModifier_do(
BLI_rw_mutex_unlock(smd->domain->fluid_mutex);
/* return generated geometry for adaptive domain */
Mesh *result;
if (smd->type & MOD_SMOKE_TYPE_DOMAIN && smd->domain &&
smd->domain->flags & MOD_SMOKE_ADAPTIVE_DOMAIN &&
smd->domain->base_res[0])
{
return createDomainGeometry(smd->domain, ob);
result = createDomainGeometry(smd->domain, ob);
}
else {
return BKE_mesh_copy_for_eval(me, false);
result = BKE_mesh_copy_for_eval(me, false);
}
/* XXX This is really not a nice hack, but until root of the problem is understood,
* this should be an acceptable workaround I think.
* See T58492 for details on the issue. */
result->texflag |= ME_AUTOSPACE;
return result;
}
static float calc_voxel_transp(float *result, float *input, int res[3], int *pixel, float *tRay, float correct)