[Bf-blender-cvs] [3c15410] hair_system: Simple air drag term for hair.
Lukas Tönne
noreply at git.blender.org
Fri Aug 8 13:49:08 CEST 2014
Commit: 3c154105ce80c6a88071fe6369278aa4c89bcc6a
Author: Lukas Tönne
Date: Fri Aug 8 13:46:19 2014 +0200
Branches: hair_system
https://developer.blender.org/rB3c154105ce80c6a88071fe6369278aa4c89bcc6a
Simple air drag term for hair.
This avoids ceaseless movement and is physically quite plausible. It
doesn't replace real hair-hair collision though.
===================================================================
M release/scripts/startup/bl_ui/properties_data_modifier.py
M source/blender/hair/intern/HAIR_solver.cpp
M source/blender/makesdna/DNA_hair_types.h
M source/blender/makesrna/intern/rna_hair.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py
index 837c86a..681d39e 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -1249,8 +1249,9 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
row = col.row()
col2 = row.column()
col2.prop(params, "restitution")
- col2 = row.column()
col2.prop(params, "friction")
+ col2 = row.column()
+ col2.prop(params, "drag")
col.separator()
diff --git a/source/blender/hair/intern/HAIR_solver.cpp b/source/blender/hair/intern/HAIR_solver.cpp
index 3358f47..69372a6 100644
--- a/source/blender/hair/intern/HAIR_solver.cpp
+++ b/source/blender/hair/intern/HAIR_solver.cpp
@@ -286,7 +286,9 @@ static void do_external_forces(const HairParams ¶ms, const SolverForces &for
{
float3 acc = float3(0.0f, 0.0f, 0.0f);
- acc = acc + forces.gravity;
+ float3 drag = - params.drag * point0->cur.vel;
+
+ acc = acc + forces.gravity + drag;
force = acc;
}
diff --git a/source/blender/makesdna/DNA_hair_types.h b/source/blender/makesdna/DNA_hair_types.h
index b4b210d..d9dc77d 100644
--- a/source/blender/makesdna/DNA_hair_types.h
+++ b/source/blender/makesdna/DNA_hair_types.h
@@ -62,11 +62,11 @@ typedef struct HairParams {
float bend_damping;
float bend_smoothing;
+ float drag;
+
/* collision settings */
float restitution;
float friction;
-
- int pad;
} HairParams;
typedef struct HairSystem {
diff --git a/source/blender/makesrna/intern/rna_hair.c b/source/blender/makesrna/intern/rna_hair.c
index 90b9184..7495996 100644
--- a/source/blender/makesrna/intern/rna_hair.c
+++ b/source/blender/makesrna/intern/rna_hair.c
@@ -106,6 +106,13 @@ static void rna_def_hair_params(BlenderRNA *brna)
RNA_def_property_ui_range(prop, 0.0f, 8.0f, 0.1, 2);
RNA_def_property_ui_text(prop, "Bend Smoothing", "Smoothing amount to avoid rotation of hair curls");
+ prop = RNA_def_property(srna, "drag", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "drag");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.01f, 3);
+ RNA_def_property_float_default(prop, 0.0f);
+ RNA_def_property_ui_text(prop, "Drag", "Air drag factor");
+
prop = RNA_def_property(srna, "friction", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "friction");
RNA_def_property_range(prop, 0.0f, FLT_MAX);
More information about the Bf-blender-cvs
mailing list