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-03-12 15:38:11 +0300
committerJanne Karhu <jhkarh@gmail.com>2011-03-12 15:38:11 +0300
commit5b75593c239f9db213c07804f41a130751245cb6 (patch)
tree58b0af98cc1b74be556a966e2c9fbba9fb136f49 /source/blender/makesdna/DNA_particle_types.h
parent60fe23b10006095a53bc9dc845ea09bf05168d2c (diff)
Completely refactored sph fluid particles. Only the very core of the algorithm remains
the same, but big changes have happened both on the outside and on the inside. New UI: * The old parameters were quite true to the underlying algorithm, but were quite obscure from a users point of view. Now there are only a few intuitive basic parameters that define the basic fluid behavior. ** By default particle size is now used to determine the interaction radius, rest density and spring rest lengths so that it's easy to get stable simulations by simply emitting particles for a few frames and adjusting the particle size (easy when the particle size is drawn) so that the fluid appears continuous (particles are touching eachother). ** Stiffness - in reality most fluids are very incompressible, but this is a very hard problem to solve with particle based fluid simulation so some compromises have to be made. So the bigger the stiffness parameter is the less the fluid will compress under stress, but the more substeps are needed for stable simulation. ** Viscosity - how much internal friction there is in the fluid. Large viscosities also smooth out instabilities, so less viscous fluids again need more substeps to remain stable. ** Buoancy - with high buoancy low pressure areas inside the fluid start to rise against gravity, and high pressure areas start to come down. * In addition to these basic parameters there are separate advanced parameters that can either be tweaked relative to the basic parameters (or particle size) or defined independently. ** Repulsion - the stiffness parameter tries to keep the fluid density constant, but this can lead to small clumps of particles, so the repulsion keeps the particles better separated. ** Stiff viscosity - the normal viscosity only applies when particles are moving closer to eachother to allow free flowing fluids. Stiff viscosity also applies smoothing to particles that are moving away from eachother. ** Interaction radius - by default this is 4 * particle size. ** Rest density - by default this is a density that the particles have when they're packed densely next to eachother. ** Spring rest length - by default this is 2 * particle size. * There are also new options for 3d view particle coloring in the display panel to show particle velocity and acceleration. These make it easier to see what's happening in the fluid simulations, but can of course be used with other particles as well. * Viscoelastic springs have some new options too. The plasticity can now be set to much higher values for instant deletion of springs as the elastic limit is exeeded. In addition to that there is an option to only create springs for a certain number of frames when a particle is born. These options give new possibilities for breaking viscoelastic fluids. New in the code: * Most of the fluids code is now thread safe, so when particle dynamics go threaded there will be a nice speed boost to fluids as well. * Fluids now use a bvh-tree instead of a kd-tree for the neighbor lookups. The bvh-tree implementation makes the code quite a bit cleaner and should also give a slight speed boost to the simulation too. * Previously only force fields were calculated with the different integration methods, but now the fluid calculations are also done using the selected integration method, so there are again more choices in effecting simulation accuracy and stability. This change also included a nice cleanup of the whole particle integration code. As the internals are pretty stirred up old particle fluid simulations will probably not work correctly straight away, but with some tweaking the same level of control is still available by not using the "relative versions" of the advanced parameters (by default these are not used when loading old files).
Diffstat (limited to 'source/blender/makesdna/DNA_particle_types.h')
-rw-r--r--source/blender/makesdna/DNA_particle_types.h36
1 files changed, 27 insertions, 9 deletions
diff --git a/source/blender/makesdna/DNA_particle_types.h b/source/blender/makesdna/DNA_particle_types.h
index b146d49365c..09053848b28 100644
--- a/source/blender/makesdna/DNA_particle_types.h
+++ b/source/blender/makesdna/DNA_particle_types.h
@@ -123,16 +123,23 @@ typedef struct ParticleData {
typedef struct SPHFluidSettings {
/*Particle Fluid*/
- float spring_k, radius, rest_length, plasticity_constant, yield_ratio;
+ float radius, spring_k, rest_length;
+ float plasticity_constant, yield_ratio;
+ float plasticity_balance, yield_balance;
float viscosity_omega, viscosity_beta;
float stiffness_k, stiffness_knear, rest_density;
float buoyancy;
- int flag, pad;
+ int flag, spring_frames;
} SPHFluidSettings;
/* fluid->flag */
#define SPH_VISCOELASTIC_SPRINGS 1
#define SPH_CURRENT_REST_LENGTH 2
+#define SPH_FAC_REPULSION 4
+#define SPH_FAC_DENSITY 8
+#define SPH_FAC_RADIUS 16
+#define SPH_FAC_VISCOSITY 32
+#define SPH_FAC_REST_LENGTH 64
typedef struct ParticleSettings {
ID id;
@@ -143,12 +150,12 @@ typedef struct ParticleSettings {
struct EffectorWeights *effector_weights;
- int flag;
+ int flag, rt;
short type, from, distr, texact;
/* physics modes */
short phystype, rotmode, avemode, reactevent;
short draw, draw_as, draw_size, childtype;
- short ren_as, subframes;
+ short ren_as, subframes, draw_col;
/* number of path segments, power of 2 except */
short draw_step, ren_step;
short hair_step, keys_step;
@@ -157,12 +164,15 @@ typedef struct ParticleSettings {
short adapt_angle, adapt_pix;
short disp, omat, interpolation, rotfrom, integrator;
- short kink, kink_axis, rt2;
+ short kink, kink_axis;
/* billboards */
short bb_align, bb_uv_split, bb_anim, bb_split_offset;
float bb_tilt, bb_rand_tilt, bb_offset[2];
+ /* draw color */
+ float color_vec_max;
+
/* simplification */
short simplify_flag, simplify_refsize;
float simplify_rate, simplify_transition;
@@ -249,9 +259,9 @@ typedef struct ParticleSystem{ /* note, make sure all (runtime) are NULL's in
char name[32]; /* particle system name */
float imat[4][4]; /* used for duplicators */
- float cfra, tree_frame;
+ float cfra, tree_frame, bvhtree_frame;
int seed, child_seed;
- int flag, totpart, totunexist, totchild, totcached, totchildcache, rt;
+ int flag, totpart, totunexist, totchild, totcached, totchildcache;
short recalc, target_psys, totkeyed, bakespace;
char bb_uvname[3][32]; /* billboard uv name */
@@ -271,7 +281,8 @@ typedef struct ParticleSystem{ /* note, make sure all (runtime) are NULL's in
ParticleSpring *fluid_springs;
int tot_fluidsprings, alloc_fluidsprings;
- struct KDTree *tree; /* used for interactions with self and other systems */
+ struct KDTree *tree; /* used for interactions with self and other systems */
+ struct BVHTree *bvhtree; /* used for interactions with self and other systems */
struct ParticleDrawData *pdd;
@@ -375,10 +386,17 @@ typedef struct ParticleSystem{ /* note, make sure all (runtime) are NULL's in
#define PART_DRAW_RAND_GR 1024
#define PART_DRAW_REN_ADAPT 2048
#define PART_DRAW_VEL_LENGTH (1<<12)
-#define PART_DRAW_MAT_COL (1<<13)
+#define PART_DRAW_MAT_COL (1<<13) /* deprecated, but used in do_versions */
#define PART_DRAW_WHOLE_GR (1<<14)
#define PART_DRAW_REN_STRAND (1<<15)
+/* part->draw_col */
+#define PART_DRAW_COL_NONE 0
+#define PART_DRAW_COL_MAT 1
+#define PART_DRAW_COL_VEL 2
+#define PART_DRAW_COL_ACC 3
+
+
/* part->simplify_flag */
#define PART_SIMPLIFY_ENABLE 1
#define PART_SIMPLIFY_VIEWPORT 2