Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJanne Karhu <jhkarh@gmail.com>2011-01-09 22:09:41 +0300
committerJanne Karhu <jhkarh@gmail.com>2011-01-09 22:09:41 +0300
commit9231ff41604039ca55f1da4945a077cfab9e1e84 (patch)
treec9c29bb10aabaa44e8e683bab8d3ce7a06a39744 /source/blender/makesrna/intern/rna_particle.c
parent84a464ab62e67eb21e12d0c3b0fad061c38d9e4a (diff)
Viscoelastic springs for sph particle fluids, original patch by Stephen Whitehorn (chickencoop)
* Viscoelastic springs between the fluid particles can simulate all kinds of viscous and elastic substances, such as jelly and honey. This is achieved by creating springs dynamically between neighboring particles and adjusting their rest length based on stretching/compression. * This nearly completes the currently intended functionality for particle fluids. The last missing thing is a surfacing extraction algorithm, which is needed for a proper representation of a sph fluid. * I also cleaned up and renamed some of the fluid parameters to make the ui a bit easier to understand. * One addition to the patch is an option to use "initial rest length" for the springs, which uses the lengths between the particles at the time of spring creation as the spring rest lengths instead of interaction radius/2. This makes the fluid keep it's original shape better (good for very viscoelastic materials), but can create large density differences inside the fluid (not really physically correct for a fluid). * Viscoelastic springs are stored in point cache as extra data.
Diffstat (limited to 'source/blender/makesrna/intern/rna_particle.c')
-rw-r--r--source/blender/makesrna/intern/rna_particle.c63
1 files changed, 46 insertions, 17 deletions
diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c
index cb17893ce0d..aa5f69e7164 100644
--- a/source/blender/makesrna/intern/rna_particle.c
+++ b/source/blender/makesrna/intern/rna_particle.c
@@ -989,59 +989,88 @@ static void rna_def_fluid_settings(BlenderRNA *brna)
/* Fluid settings */
prop= RNA_def_property(srna, "spring_force", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "spring_k");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Spring", "Spring force constant");
+ RNA_def_property_range(prop, 0.0f, 100.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
+ RNA_def_property_ui_text(prop, "Spring Force", "Spring force");
RNA_def_property_update(prop, 0, "rna_Particle_reset");
prop= RNA_def_property(srna, "fluid_radius", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "radius");
- RNA_def_property_range(prop, 0.0f, 2.0f);
- RNA_def_property_ui_text(prop, "Radius", "Fluid interaction Radius");
+ RNA_def_property_range(prop, 0.0f, 20.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 2.0f, 1, 3);
+ RNA_def_property_ui_text(prop, "Interaction Radius", "Fluid interaction radius");
RNA_def_property_update(prop, 0, "rna_Particle_reset");
+ /* Hidden in ui to give a little easier user experience. */
prop= RNA_def_property(srna, "rest_length", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "rest_length");
RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Rest Length", "The Spring Rest Length (factor of interaction radius)");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
+ RNA_def_property_ui_text(prop, "Rest Length", "Spring rest length (factor of interaction radius)");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop= RNA_def_property(srna, "use_viscoelastic_springs", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_VISCOELASTIC_SPRINGS);
+ RNA_def_property_ui_text(prop, "Viscoelastic Springs", "Use viscoelastic springs instead of Hooke's springs");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop= RNA_def_property(srna, "use_initial_rest_length", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_CURRENT_REST_LENGTH);
+ RNA_def_property_ui_text(prop, "Initial Rest Length", "Use the initial length as spring rest length instead of interaction radius/2");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop= RNA_def_property(srna, "plasticity", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "plasticity_constant");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Plasticity", "How much the spring rest length can change after the elastic limit is crossed");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop= RNA_def_property(srna, "yield_ratio", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "yield_ratio");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Elastic Limit", "How much the spring has to be stretched/compressed in order to change it's rest length");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
/* Viscosity */
- prop= RNA_def_property(srna, "viscosity_omega", PROP_FLOAT, PROP_NONE);
+ prop= RNA_def_property(srna, "linear_viscosity", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "viscosity_omega");
RNA_def_property_range(prop, 0.0f, 100.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
RNA_def_property_ui_text(prop, "Viscosity", "Linear viscosity");
RNA_def_property_update(prop, 0, "rna_Particle_reset");
- prop= RNA_def_property(srna, "viscosity_beta", PROP_FLOAT, PROP_NONE);
+ prop= RNA_def_property(srna, "square_viscosity", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "viscosity_beta");
RNA_def_property_range(prop, 0.0f, 100.0f);
- RNA_def_property_ui_text(prop, "Square viscosity", "Square viscosity factor");
+ RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
+ RNA_def_property_ui_text(prop, "Square viscosity", "Square viscosity");
RNA_def_property_update(prop, 0, "rna_Particle_reset");
/* Double density relaxation */
- prop= RNA_def_property(srna, "stiffness", PROP_FLOAT, PROP_NONE);
+ prop= RNA_def_property(srna, "density_force", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "stiffness_k");
RNA_def_property_range(prop, 0.0f, 100.0f);
- RNA_def_property_ui_text(prop, "Stiffness ", "Constant K - Stiffness");
+ RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
+ RNA_def_property_ui_text(prop, "Density Force", "How strongly the fluid tends to rest density");
RNA_def_property_update(prop, 0, "rna_Particle_reset");
- prop= RNA_def_property(srna, "stiffness_near", PROP_FLOAT, PROP_NONE);
+ prop= RNA_def_property(srna, "repulsion_force", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "stiffness_knear");
RNA_def_property_range(prop, 0.0f, 100.0f);
- RNA_def_property_ui_text(prop, "Repulsion", "Repulsion factor: stiffness_knear");
+ RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
+ RNA_def_property_ui_text(prop, "Repulsion", "How strongly the fluid tries to keep from clustering");
RNA_def_property_update(prop, 0, "rna_Particle_reset");
prop= RNA_def_property(srna, "rest_density", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "rest_density");
- RNA_def_property_range(prop, 0.0f, 100.0f);
- RNA_def_property_ui_text(prop, "Rest Density", "Density");
+ RNA_def_property_range(prop, 0.0f, 1000.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3);
+ RNA_def_property_ui_text(prop, "Rest Density", "Rest density of the fluid");
RNA_def_property_update(prop, 0, "rna_Particle_reset");
/* Buoyancy */
prop= RNA_def_property(srna, "buoyancy", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "buoyancy");
RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Buoyancy", "");
+ RNA_def_property_ui_text(prop, "Buoyancy", "Artificial buoyancy force in negative gravity direction based on pressure differences inside the fluid");
RNA_def_property_update(prop, 0, "rna_Particle_reset");
}