From b1f97995084253305f708f55dc5bd3b4c3acb301 Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Wed, 10 Jun 2020 18:10:07 +0300 Subject: Cloth: implement support for a hydrostatic pressure gradient. When a fluid is put under influence of gravity or acceleration, it forms an internal pressure gradient, which causes observable effects like buoyancy. Since now cloth has support for simulating pressure changes caused by fluid compression or expansion, it makes sense to also support the effects of gravity. This is intended for better simulation of objects filled or surrounded by fluids, especially when constrained by collisions or pinned vertices, and should result in more realistic shapes. Obviously, this doesn't actually simulate fluid dynamics; instead it is assumed that the fluid immediately adapts to changes in the shape or acceleration of the object without friction or turbulence, and instantly reaches a new static equilibrium. Differential Revision: https://developer.blender.org/D6442 --- source/blender/blenkernel/BKE_cloth.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'source/blender/blenkernel/BKE_cloth.h') diff --git a/source/blender/blenkernel/BKE_cloth.h b/source/blender/blenkernel/BKE_cloth.h index f5073ff7aa5..f25482570b1 100644 --- a/source/blender/blenkernel/BKE_cloth.h +++ b/source/blender/blenkernel/BKE_cloth.h @@ -93,9 +93,10 @@ typedef struct Cloth { struct Implicit_Data *implicit; /* our implicit solver connects to this pointer */ struct EdgeSet *edgeset; /* used for selfcollisions */ int last_frame; - float initial_mesh_volume; /* Initial volume of the mesh. Used for pressure */ - struct MEdge *edges; /* Used for hair collisions. */ - struct GHash *sew_edge_graph; /* Sewing edges represented using a GHash */ + float initial_mesh_volume; /* Initial volume of the mesh. Used for pressure */ + float average_acceleration[3]; /* Moving average of overall acceleration. */ + struct MEdge *edges; /* Used for hair collisions. */ + struct GHash *sew_edge_graph; /* Sewing edges represented using a GHash */ } Cloth; /** -- cgit v1.2.3