Fluid: Added obstacle fluid distance parameter
Being able to adjust the distance between fluid and obstacles comes in handy when trying to achieve a fluid motion over inclined obstacles. Depending on the slope of such obstacles, already small adjustments of this value can help when particles stick to obstacle surfaces (i.e. make particles not stick to obstacles).
This commit is contained in:
parent
14d56b4217
commit
7167a57197
Notes:
blender-bot
2023-02-14 09:17:57 +01:00
Referenced by issue #81915, FaceSets drawing not working on mesh with shapekeys Referenced by issue #81814, Scaled Rigid Body causes issue (moving origin or mesh breaks collision, double transforms on negative scale)
|
@ -845,6 +845,7 @@ void MANTA::initializeRNAMap(FluidModifierData *fmd)
|
|||
mRNAMap["PARTICLE_MAXIMUM"] = to_string(fds->particle_maximum);
|
||||
mRNAMap["PARTICLE_RADIUS"] = to_string(fds->particle_radius);
|
||||
mRNAMap["FRACTIONS_THRESHOLD"] = to_string(fds->fractions_threshold);
|
||||
mRNAMap["FRACTIONS_DISTANCE"] = to_string(fds->fractions_distance);
|
||||
mRNAMap["MESH_CONCAVE_UPPER"] = to_string(fds->mesh_concave_upper);
|
||||
mRNAMap["MESH_CONCAVE_LOWER"] = to_string(fds->mesh_concave_lower);
|
||||
mRNAMap["MESH_PARTICLE_RADIUS"] = to_string(fds->mesh_particle_radius);
|
||||
|
|
|
@ -41,6 +41,7 @@ using_mesh_s$ID$ = $USING_MESH$\n\
|
|||
using_final_mesh_s$ID$ = $USING_IMPROVED_MESH$\n\
|
||||
using_fractions_s$ID$ = $USING_FRACTIONS$\n\
|
||||
fracThreshold_s$ID$ = $FRACTIONS_THRESHOLD$\n\
|
||||
fracDistance_s$ID$ = $FRACTIONS_DISTANCE$\n\
|
||||
flipRatio_s$ID$ = $FLIP_RATIO$\n\
|
||||
concaveUpper_s$ID$ = $MESH_CONCAVE_UPPER$\n\
|
||||
concaveLower_s$ID$ = $MESH_CONCAVE_LOWER$\n\
|
||||
|
@ -243,6 +244,8 @@ def liquid_step_$ID$():\n\
|
|||
pp_s$ID$.advectInGrid(flags=flags_s$ID$, vel=vel_s$ID$, integrationMode=IntRK4, deleteInObstacle=deleteInObstacle_s$ID$, stopInObstacle=False, skipNew=True)\n\
|
||||
\n\
|
||||
mantaMsg('Pushing particles out of obstacles')\n\
|
||||
if using_obstacle_s$ID$:\n\
|
||||
pushOutofObs(parts=pp_s$ID$, flags=flags_s$ID$, phiObs=phiObsIn_s$ID$, thresh=fracDistance_s$ID$)\n\
|
||||
pushOutofObs(parts=pp_s$ID$, flags=flags_s$ID$, phiObs=phiObs_s$ID$)\n\
|
||||
\n\
|
||||
# save original states for later (used during mesh / secondary particle creation)\n\
|
||||
|
|
|
@ -507,7 +507,8 @@ class PHYSICS_PT_liquid(PhysicButtonsPanel, Panel):
|
|||
col.prop(domain, "use_fractions", text="Fractional Obstacles")
|
||||
sub = col.column()
|
||||
sub.active = domain.use_fractions
|
||||
sub.prop(domain, "fractions_threshold", text="Obstacle-Fluid Threshold")
|
||||
sub.prop(domain, "fractions_distance", text="Obstacle Distance")
|
||||
sub.prop(domain, "fractions_threshold", text="Threshold")
|
||||
|
||||
|
||||
class PHYSICS_PT_flow_source(PhysicButtonsPanel, Panel):
|
||||
|
|
|
@ -4985,6 +4985,7 @@ void BKE_fluid_modifier_copy(const struct FluidModifierData *fmd,
|
|||
tfds->particle_radius = fds->particle_radius;
|
||||
tfds->particle_band_width = fds->particle_band_width;
|
||||
tfds->fractions_threshold = fds->fractions_threshold;
|
||||
tfds->fractions_distance = fds->fractions_distance;
|
||||
tfds->sys_particle_maximum = fds->sys_particle_maximum;
|
||||
|
||||
/* diffusion options*/
|
||||
|
|
|
@ -912,4 +912,17 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_elem_find(fd->filesdna, "FluidModifierData", "float", "fractions_distance")) {
|
||||
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
|
||||
LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
|
||||
if (md->type == eModifierType_Fluid) {
|
||||
FluidModifierData *fmd = (FluidModifierData *)md;
|
||||
if (fmd->domain) {
|
||||
fmd->domain->fractions_distance = 0.5;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -109,6 +109,7 @@
|
|||
.particle_radius = 1.0f, \
|
||||
.particle_band_width = 3.0f, \
|
||||
.fractions_threshold = 0.05f, \
|
||||
.fractions_distance = 0.5f, \
|
||||
.flip_ratio = 0.97f, \
|
||||
.sys_particle_maximum = 0, \
|
||||
.simulation_method = FLUID_DOMAIN_METHOD_FLIP, \
|
||||
|
|
|
@ -586,10 +586,11 @@ typedef struct FluidDomainSettings {
|
|||
float particle_radius;
|
||||
float particle_band_width;
|
||||
float fractions_threshold;
|
||||
float fractions_distance;
|
||||
float flip_ratio;
|
||||
int sys_particle_maximum;
|
||||
short simulation_method;
|
||||
char _pad4[2];
|
||||
char _pad4[6];
|
||||
|
||||
/* Diffusion options. */
|
||||
float surface_tension;
|
||||
|
|
|
@ -1895,12 +1895,22 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna)
|
|||
RNA_def_property_range(prop, 0.001, 1.0);
|
||||
RNA_def_property_ui_range(prop, 0.01, 1.0, 0.05, -1);
|
||||
RNA_def_property_ui_text(prop,
|
||||
"Obstacle-Fluid Threshold",
|
||||
"Obstacle Threshold",
|
||||
"Determines how much fluid is allowed in an obstacle cell "
|
||||
"(higher values will tag a boundary cell as an obstacle easier "
|
||||
"and reduce the boundary smoothening effect)");
|
||||
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset");
|
||||
|
||||
prop = RNA_def_property(srna, "fractions_distance", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_range(prop, -5.0, 5.0);
|
||||
RNA_def_property_ui_range(prop, 0.01, 5.0, 0.1, -1);
|
||||
RNA_def_property_ui_text(prop,
|
||||
"Obstacle Distance",
|
||||
"Determines how far apart fluid and obstacle are (higher values will "
|
||||
"result in fluid being further away from obstacles, smaller values "
|
||||
"will let fluid move towards the inside of obstacles)");
|
||||
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset");
|
||||
|
||||
prop = RNA_def_property(srna, "sys_particle_maximum", PROP_INT, PROP_NONE);
|
||||
RNA_def_property_int_sdna(prop, NULL, "sys_particle_maximum");
|
||||
RNA_def_property_range(prop, 0, INT_MAX);
|
||||
|
|
Loading…
Reference in New Issue