Fix #107679: Smoke simulation adaptive domain shrinks too much

* Take into account heat grid in addition to density and fuel, as this is used for
  displaying smoke in Blender.
* Lower adaptive domain threshold from 0.02 to 0.002, to fix visual issues with
  small smoke density that can still be visible.

Pull Request: https://projects.blender.org/blender/blender/pulls/139940
This commit is contained in:
Bartosz Kosiorek
2025-07-28 14:15:07 +02:00
committed by Brecht Van Lommel
parent 445eceb02a
commit fe96b2a613
4 changed files with 9 additions and 7 deletions

View File

@@ -2222,6 +2222,7 @@ static void adaptive_domain_adjust(
int x, y, z;
float *density = manta_smoke_get_density(fds->fluid);
float *fuel = manta_smoke_get_fuel(fds->fluid);
float *heat = manta_smoke_get_heat(fds->fluid);
float *bigdensity = manta_noise_get_density(fds->fluid);
float *bigfuel = manta_noise_get_fuel(fds->fluid);
float *vx = manta_get_velocity_x(fds->fluid);
@@ -2258,6 +2259,7 @@ static void adaptive_domain_adjust(
fds->res[1],
z - fds->res_min[2]);
max_den = (fuel) ? std::max(density[index], fuel[index]) : density[index];
max_den = (heat) ? std::max(max_den, heat[index]) : max_den;
/* Check high resolution bounds if max density isn't already high enough. */
if (max_den < fds->adapt_threshold && fds->flags & FLUID_DOMAIN_USE_NOISE && fds->fluid) {

View File

@@ -1988,7 +1988,7 @@ void blo_do_versions_260(FileData *fd, Library * /*lib*/, Main *bmain)
fmd->domain->flame_vorticity = 0.5f;
fmd->domain->flame_ignition = 1.25f;
fmd->domain->flame_max_temp = 1.75f;
fmd->domain->adapt_threshold = 0.02f;
fmd->domain->adapt_threshold = 0.002f;
fmd->domain->adapt_margin = 4;
fmd->domain->flame_smoke_color[0] = 0.7f;
fmd->domain->flame_smoke_color[1] = 0.7f;

View File

@@ -62,7 +62,7 @@
.gravity_final = {0.0f, 0.0f, 0.0f}, \
.adapt_margin = 4, \
.adapt_res = 0, \
.adapt_threshold = 0.02f, \
.adapt_threshold = 0.002f, \
.maxres = 32, \
.solver_res = 3, \
.border_collisions = 0, \

View File

@@ -1573,11 +1573,11 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna)
prop = RNA_def_property(srna, "adapt_threshold", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0, 1.0);
RNA_def_property_ui_range(prop, 0.0, 1.0, 0.02, 6);
RNA_def_property_ui_text(
prop,
"Threshold",
"Minimum amount of fluid a cell can contain before it is considered empty");
RNA_def_property_ui_range(prop, 0.0, 1.0, 0.002, 6);
RNA_def_property_ui_text(prop,
"Threshold",
"Minimum amount of fluid grid values (smoke density, fuel and heat) a "
"cell can contain, before it is considered empty");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset");
prop = RNA_def_property(srna, "use_adaptive_domain", PROP_BOOLEAN, PROP_NONE);