|
| static int | blender::particles_are_dynamic (ParticleSystem *psys) |
| float | blender::psys_get_current_display_percentage (struct ParticleSystem *psys, bool use_render_params) |
| static int | blender::tot_particles (ParticleSystem *psys, PTCacheID *pid) |
| void | blender::psys_reset (struct ParticleSystem *psys, int mode) |
| void | blender::psys_unique_name (struct Object *object, struct ParticleSystem *psys, const char *defname) ATTR_NONNULL(1 |
| static void | blender::realloc_particles (ParticleSimulationData *sim, int new_totpart) |
| int | blender::psys_get_child_number (struct Scene *scene, struct ParticleSystem *psys, bool use_render_params) |
| int | blender::psys_get_tot_child (struct Scene *scene, struct ParticleSystem *psys, bool use_render_params) |
| void | blender::psys_calc_dmcache (struct Object *ob, struct Mesh *mesh_final, struct Mesh *mesh_original, struct ParticleSystem *psys) |
| void | blender::psys_thread_context_init (struct ParticleThreadContext *ctx, struct ParticleSimulationData *sim) |
| Vector< ParticleTask > | blender::psys_tasks_create (struct ParticleThreadContext *ctx, int startpart, int endpart) |
| void | blender::psys_tasks_free (Vector< ParticleTask > &tasks) |
| void | blender::psys_thread_context_free (struct ParticleThreadContext *ctx) |
| static void | blender::init_particle_texture (ParticleSimulationData *sim, ParticleData *pa, int p) |
| void | blender::init_particle (struct ParticleSimulationData *sim, struct ParticleData *pa) |
| static void | blender::initialize_all_particles (ParticleSimulationData *sim) |
| static void | blender::free_unexisting_particles (ParticleSimulationData *sim) |
| static void | blender::get_angular_velocity_vector (short avemode, ParticleKey *state, float vec[3]) |
| void | blender::psys_get_birth_coords (struct ParticleSimulationData *sim, struct ParticleData *pa, struct ParticleKey *state, float dtime, float cfra) |
| static void | blender::evaluate_emitter_anim (Depsgraph *depsgraph, Scene *scene, Object *ob, float cfra) |
| void | blender::reset_particle (struct ParticleSimulationData *sim, struct ParticleData *pa, float dtime, float cfra) |
| static void | blender::reset_all_particles (ParticleSimulationData *sim, float dtime, float cfra, int from) |
| struct ParticleSystem * | blender::psys_get_target_system (struct Object *ob, struct ParticleTarget *pt) |
| void | blender::psys_count_keyed_targets (struct ParticleSimulationData *sim) |
| static void | blender::set_keyed_keys (ParticleSimulationData *sim) |
| void | blender::psys_make_temp_pointcache (struct Object *ob, struct ParticleSystem *psys) |
| static void | blender::psys_clear_temp_pointcache (ParticleSystem *psys) |
| void | blender::psys_get_pointcache_start_end (struct Scene *scene, ParticleSystem *psys, int *sfra, int *efra) |
| static void | blender::bvhtree_balance_isolated (void *userdata) |
| static void | blender::psys_update_particle_bvhtree (ParticleSystem *psys, float cfra) |
| void | blender::psys_update_particle_tree (struct ParticleSystem *psys, float cfra) |
| static void | blender::psys_update_effectors (ParticleSimulationData *sim) |
| static void | blender::integrate_particle (ParticleSettings *part, ParticleData *pa, float dtime, float *external_acceleration, void(*force_func)(void *forcedata, ParticleKey *state, float *force, float *impulse), void *forcedata) |
| static void | blender::basic_force_cb (void *efdata_v, ParticleKey *state, float *force, float *impulse) |
| static void | blender::basic_integrate (ParticleSimulationData *sim, int p, float dfra, float cfra) |
| static void | blender::basic_rotate (ParticleSettings *part, ParticleData *pa, float dfra, float timestep) |
| static SPHData | blender::dynamics_step_sphdata_reduce (const SPHData &sphdata_to, const SPHData &sphdata_from) |
| static void | blender::dynamics_step_sph_ddr_task_cb_ex (DynamicStepSolverTaskData *data, const int p, SPHData *sphdata) |
| static void | blender::dynamics_step_sph_classical_basic_integrate_task_cb_ex (void *__restrict userdata, const int p, const TaskParallelTLS *__restrict) |
| static void | blender::dynamics_step_sph_classical_calc_density_task_cb_ex (void *__restrict userdata, const int p, const TaskParallelTLS *__restrict tls) |
| static void | blender::dynamics_step_sph_classical_integrate_task_cb_ex (void *__restrict userdata, const int p, const TaskParallelTLS *__restrict tls) |
| static void | blender::dynamics_step (ParticleSimulationData *sim, float cfra) |
| static void | blender::update_children (ParticleSimulationData *sim, const bool use_render_params) |
| static void | blender::cached_step (ParticleSimulationData *sim, float cfra, const bool use_render_params) |
| static bool | blender::particles_has_flip (short parttype) |
| static bool | blender::particles_has_tracer (short parttype) |
| static bool | blender::particles_has_spray (short parttype) |
| static bool | blender::particles_has_bubble (short parttype) |
| static bool | blender::particles_has_foam (short parttype) |
| static void | blender::particles_fluid_step (ParticleSimulationData *sim, int cfra, const bool use_render_params) |
| static int | blender::emit_particles (ParticleSimulationData *sim, PTCacheID *pid, float) |
| static void | blender::system_step (ParticleSimulationData *sim, float cfra, const bool use_render_params) |
| void | blender::psys_changed_type (struct Object *ob, struct ParticleSystem *psys) |
| void | blender::psys_check_boid_data (struct ParticleSystem *psys) |
| void | blender::BKE_particlesettings_fluid_default_settings (struct ParticleSettings *part) |
| static void | blender::psys_prepare_physics (ParticleSimulationData *sim) |
| static int | blender::hair_needs_recalc (ParticleSystem *psys) |
| static ParticleSettings * | blender::particle_settings_localize (ParticleSettings *particle_settings) |
| static void | blender::particle_settings_free_local (ParticleSettings *particle_settings) |
| void | blender::particle_system_update (struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct ParticleSystem *psys, bool use_render_params) |
| static void | blender::particlesystem_modifiersForeachIDLink (void *user_data, Object *, ID **id_pointer, const LibraryForeachIDCallbackFlag cb_flag) |
| void | blender::BKE_particlesystem_id_loop (struct ParticleSystem *psys, ParticleSystemIDFunc func, void *userdata) |
| void | blender::BKE_particlesystem_reset_all (struct Object *object) |
| void | blender::BKE_particle_settings_eval_reset (struct Depsgraph *depsgraph, struct ParticleSettings *particle_settings) |
| void | blender::BKE_particle_system_eval_init (struct Depsgraph *depsgraph, struct Object *object) |
|
In theory, there could be unlimited implementation of SPH simulators
This code uses in some parts adapted algorithms from the pseudo code as outlined in the Research paper:
Titled: Particle-based Viscoelastic Fluid Simulation. Authors: Simon Clavet, Philippe Beaudoin and Pierre Poulin Website: http://www.iro.umontreal.ca/labs/infographie/papers/Clavet-2005-PVFS/
Presented at SIGGRAPH, (2005)
|
| #define | PSYS_FLUID_SPRINGS_INITIAL_SIZE 256 |
| #define | SPH_NEIGHBORS 512 |
| static ParticleSpring * | blender::sph_spring_add (ParticleSystem *psys, ParticleSpring *spring) |
| static void | blender::sph_spring_delete (ParticleSystem *psys, int j) |
| static void | blender::sph_springs_modify (ParticleSystem *psys, float dtime) |
| static Map< OrderedEdge, int > | blender::sph_springhash_build (ParticleSystem *psys) |
| static void | blender::sph_evaluate_func (BVHTree *tree, ParticleSystem **psys, const float co[3], SPHRangeData *pfr, float interaction_radius, BVHTree_RangeQuery callback) |
| static void | blender::sph_density_accum_cb (void *userdata, int index, const float co[3], float squared_dist) |
| static void | blender::sph_particle_courant (SPHData *sphdata, SPHRangeData *pfr) |
| static void | blender::sph_force_cb (void *sphdata_v, ParticleKey *state, float *force, float *) |
| static void | blender::sphclassical_density_accum_cb (void *userdata, int index, const float co[3], float) |
| static void | blender::sphclassical_neighbor_accum_cb (void *userdata, int index, const float co[3], float) |
| static void | blender::sphclassical_force_cb (void *sphdata_v, ParticleKey *state, float *force, float *) |
| static void | blender::sphclassical_calc_dens (ParticleData *pa, float, SPHData *sphdata) |
| static void | blender::psys_sph_init (ParticleSimulationData *sim, SPHData *sphdata, Map< OrderedEdge, int > &r_eh) |
| static void | blender::psys_sph_flush_springs (SPHData *sphdata) |
| void | blender::psys_sph_finalize (struct SPHData *sphdata) |
| void | blender::psys_sph_density (struct BVHTree *tree, struct SPHData *data, float co[3], float vars[2]) |
| static void | blender::sph_integrate (ParticleSimulationData *sim, ParticleData *pa, float dfra, SPHData *sphdata) |
|
The algorithm is roughly:
- Use a BVH tree to search for faces that a particle may collide with.
- Use Newton's method to find the exact time at which the collision occurs. https://en.wikipedia.org/wiki/Newton's_method
|
| #define | COLLISION_MIN_RADIUS 0.001f |
| #define | COLLISION_MIN_DISTANCE 0.0001f |
| #define | COLLISION_ZERO 0.00001f |
| #define | COLLISION_INIT_STEP 0.00008f |
| using | blender::NRDistanceFunc |
| static float | blender::nr_signed_distance_to_plane (float *p, float radius, ParticleCollisionElement *pce, float *nor) |
| static float | blender::nr_distance_to_edge (float *p, float radius, ParticleCollisionElement *pce, float *) |
| static float | blender::nr_distance_to_vert (float *p, float radius, ParticleCollisionElement *pce, float *) |
| static void | blender::collision_interpolate_element (ParticleCollisionElement *pce, float t, float fac, ParticleCollision *col) |
| static void | blender::collision_point_velocity (ParticleCollisionElement *pce) |
| static float | blender::collision_point_distance_with_normal (float p[3], ParticleCollisionElement *pce, float fac, ParticleCollision *col, float *nor) |
| static void | blender::collision_point_on_surface (const float p[3], ParticleCollisionElement *pce, float fac, ParticleCollision *col, float *co) |
| static float | blender::collision_newton_rhapson (ParticleCollision *col, float radius, ParticleCollisionElement *pce, NRDistanceFunc distance_func) |
| static int | blender::collision_sphere_to_tri (ParticleCollision *col, float radius, ParticleCollisionElement *pce, float *t) |
| static int | blender::collision_sphere_to_edges (ParticleCollision *col, float radius, ParticleCollisionElement *pce, float *t) |
| static int | blender::collision_sphere_to_verts (ParticleCollision *col, float radius, ParticleCollisionElement *pce, float *t) |
| void | blender::BKE_psys_collision_neartest_cb (void *userdata, int index, const BVHTreeRay *ray, BVHTreeRayHit *hit) |
| static int | blender::collision_detect (ParticleData *pa, ParticleCollision *col, BVHTreeRayHit *hit, ListBaseT< ColliderCache > *colliders) |
| static int | blender::collision_response (ParticleSimulationData *sim, ParticleData *pa, ParticleCollision *col, BVHTreeRayHit *hit, int kill, int dynamic_rotation) |
| static void | blender::collision_fail (ParticleData *pa, ParticleCollision *col) |
| static void | blender::collision_check (ParticleSimulationData *sim, int p, float dfra, float cfra) |