[Bf-blender-cvs] [3891ad8e031] master: Fix T58492: smoke flow jitters around flow source when using adaptive domain.

Bastien Montagne noreply at git.blender.org
Tue Jan 22 21:52:47 CET 2019


Commit: 3891ad8e03176d993b8082292638117a2963f931
Author: Bastien Montagne
Date:   Tue Jan 22 21:49:38 2019 +0100
Branches: master
https://developer.blender.org/rB3891ad8e03176d993b8082292638117a2963f931

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).

===================================================================

M	source/blender/blenkernel/intern/DerivedMesh.c
M	source/blender/blenkernel/intern/smoke.c

===================================================================

diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index 8428bc580d4..6b557e1749a 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -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);
 
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index ac9c593ef65..918185e0ffb 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -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)



More information about the Bf-blender-cvs mailing list