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:
authorSebastián Barschkis <sebbas@sebbas.org>2020-11-26 01:17:47 +0300
committerSebastián Barschkis <sebbas@sebbas.org>2020-11-26 01:18:12 +0300
commite09d0c0d077cff79b55ce32ec5124d5faa73e2e7 (patch)
tree74dd76ecf5016e4b34ffb42b42b7eaae980b44d4 /extern/mantaflow/preprocessed/plugin/flip.cpp
parentf7223d5f722ac430041a748248b45c8590c3ffad (diff)
Fluid: Updated Mantaflow source files
This update introduces two improvements from the Mantaflow repository: (1) Improved particle sampling: - Liquid and secondary particles are sampled more predictably. With all parameters being equal, baked particles will be computed at the exact same position during every bake. - Before, this was not guaranteed. (2) Sparse grid caching: - While saving grid data to disk, grids will from now on be saved in a sparse structure whenever possible (e.g. density, flame but not levelsets). - With the sparse optimization grid cells with a value under the 'Empty Space' value (already present in domain settings) will not be cached. - The main benefits of this optimization are: Smaller cache sizes and faster playback of simulation data in the viewport. - This optimization works 'out-of-the-box'. There is no option in the UI to enable it. - For now, only smoke simulation grids will take advantage of this optimization.
Diffstat (limited to 'extern/mantaflow/preprocessed/plugin/flip.cpp')
-rw-r--r--extern/mantaflow/preprocessed/plugin/flip.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/extern/mantaflow/preprocessed/plugin/flip.cpp b/extern/mantaflow/preprocessed/plugin/flip.cpp
index 1acdac1c094..eaa1ebe45d5 100644
--- a/extern/mantaflow/preprocessed/plugin/flip.cpp
+++ b/extern/mantaflow/preprocessed/plugin/flip.cpp
@@ -41,7 +41,7 @@ void sampleFlagsWithParticles(const FlagGrid &flags,
const bool is3D = flags.is3D();
const Real jlen = randomness / discretization;
const Vec3 disp(1.0 / discretization, 1.0 / discretization, 1.0 / discretization);
- RandomStream mRand(9832);
+ RandomStream rand(parts.getSeed());
FOR_IJK_BND(flags, 0)
{
@@ -53,7 +53,7 @@ void sampleFlagsWithParticles(const FlagGrid &flags,
for (int dj = 0; dj < discretization; dj++)
for (int di = 0; di < discretization; di++) {
Vec3 subpos = pos + disp * Vec3(0.5 + di, 0.5 + dj, 0.5 + dk);
- subpos += jlen * (Vec3(1, 1, 1) - 2.0 * mRand.getVec3());
+ subpos += jlen * (Vec3(1, 1, 1) - 2.0 * rand.getVec3());
if (!is3D)
subpos[2] = 0.5;
parts.addBuffered(subpos);
@@ -113,7 +113,7 @@ void sampleLevelsetWithParticles(const LevelsetGrid &phi,
const bool is3D = phi.is3D();
const Real jlen = randomness / discretization;
const Vec3 disp(1.0 / discretization, 1.0 / discretization, 1.0 / discretization);
- RandomStream mRand(9832);
+ RandomStream rand(parts.getSeed());
if (reset) {
parts.clear();
@@ -132,7 +132,7 @@ void sampleLevelsetWithParticles(const LevelsetGrid &phi,
for (int dj = 0; dj < discretization; dj++)
for (int di = 0; di < discretization; di++) {
Vec3 subpos = pos + disp * Vec3(0.5 + di, 0.5 + dj, 0.5 + dk);
- subpos += jlen * (Vec3(1, 1, 1) - 2.0 * mRand.getVec3());
+ subpos += jlen * (Vec3(1, 1, 1) - 2.0 * rand.getVec3());
if (!is3D)
subpos[2] = 0.5;
if (phi.getInterpolated(subpos) > 0.)
@@ -205,7 +205,7 @@ void sampleShapeWithParticles(const Shape &shape,
const bool is3D = flags.is3D();
const Real jlen = randomness / discretization;
const Vec3 disp(1.0 / discretization, 1.0 / discretization, 1.0 / discretization);
- RandomStream mRand(9832);
+ RandomStream rand(parts.getSeed());
if (reset) {
parts.clear();
@@ -223,7 +223,7 @@ void sampleShapeWithParticles(const Shape &shape,
for (int dj = 0; dj < discretization; dj++)
for (int di = 0; di < discretization; di++) {
Vec3 subpos = pos + disp * Vec3(0.5 + di, 0.5 + dj, 0.5 + dk);
- subpos += jlen * (Vec3(1, 1, 1) - 2.0 * mRand.getVec3());
+ subpos += jlen * (Vec3(1, 1, 1) - 2.0 * rand.getVec3());
if (!is3D)
subpos[2] = 0.5;
if (exclude && exclude->getInterpolated(subpos) <= 0.)
@@ -576,7 +576,7 @@ void adjustNumber(BasicParticleSystem &parts,
}
// seed new particles
- RandomStream mRand(9832);
+ RandomStream rand(parts.getSeed());
FOR_IJK(tmp)
{
int cnt = tmp(i, j, k);
@@ -593,7 +593,7 @@ void adjustNumber(BasicParticleSystem &parts,
if (flags.isFluid(i, j, k) && cnt < minParticles) {
for (int m = cnt; m < minParticles; m++) {
- Vec3 pos = Vec3(i, j, k) + mRand.getVec3();
+ Vec3 pos = Vec3(i, j, k) + rand.getVec3();
// Vec3 pos (i + 0.5, j + 0.5, k + 0.5); // cell center
parts.addBuffered(pos);
}