From b0d1a523115827c813186fee189d734657721fc3 Mon Sep 17 00:00:00 2001 From: austin Date: Sun, 19 Jan 2025 17:12:39 -0500 Subject: [PATCH] more fudging pressure numbers --- .../c/includes/fluid/sim/pressurecell/solver_consts.h | 9 +++++++-- src/main/c/src/fluid/sim/pressurecell/pressure.c | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/c/includes/fluid/sim/pressurecell/solver_consts.h b/src/main/c/includes/fluid/sim/pressurecell/solver_consts.h index 2350c940..e2332115 100644 --- a/src/main/c/includes/fluid/sim/pressurecell/solver_consts.h +++ b/src/main/c/includes/fluid/sim/pressurecell/solver_consts.h @@ -75,7 +75,12 @@ /** * Percentage of presure to keep from last frame */ -#define FLUID_PRESSURECELL_PRESSURE_BACKDOWN_FACTOR 0.0f +#define FLUID_PRESSURECELL_PRESSURE_BACKDOWN_FACTOR 1.0f + +/** + * Percentage of divergence to keep from last frame + */ +#define FLUID_PRESSURECELL_DIVERGENCE_BACKDOWN_FACTOR 1.0f /** * Pressure added on recapturing fluid pushed into borders @@ -99,7 +104,7 @@ /** * Enables recapture of density when velocity pushes it outside of bounds */ -#define FLUID_PRESSURECELL_ENABLE_RECAPTURE 0 +#define FLUID_PRESSURECELL_ENABLE_RECAPTURE 1 /** * Enables clamping small density values to 0 diff --git a/src/main/c/src/fluid/sim/pressurecell/pressure.c b/src/main/c/src/fluid/sim/pressurecell/pressure.c index 82712f4b..c98e3e56 100644 --- a/src/main/c/src/fluid/sim/pressurecell/pressure.c +++ b/src/main/c/src/fluid/sim/pressurecell/pressure.c @@ -85,7 +85,7 @@ LIBRARY_API void pressurecell_approximate_pressure(Environment * environment, Ch for(z = 0; z < DIM; z++){ for(y = 0; y < DIM; y++){ for(x = 0; x < DIM; x++){ - phi0[IX(x,y,z)] = divCache[IX(x,y,z)]; + phi0[IX(x,y,z)] = divCache[IX(x,y,z)] * FLUID_PRESSURECELL_DIVERGENCE_BACKDOWN_FACTOR; pressureTemp[IX(x,y,z)] = pressureCache[IX(x,y,z)] * FLUID_PRESSURECELL_PRESSURE_BACKDOWN_FACTOR; // pressureTemp[IX(x,y,z)] = 0; if(divCache[IX(x,y,z)] > DIVERGENCE_WARNING_VALUE){