From 55bdaab4da82c95cd7119273f74c5d7534c40416 Mon Sep 17 00:00:00 2001 From: Bartosz Kosiorek Date: Fri, 22 Aug 2025 19:19:29 +0200 Subject: [PATCH] Fix #144701: Wrong falling fluid behaviour Error introduced with performance improvement in #137733. Pull Request: https://projects.blender.org/blender/blender/pulls/144884 --- .../patches/liquid-performance.patch | 24 +++++++++---------- extern/mantaflow/preprocessed/fastmarch.cpp | 24 +++++++++---------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/extern/mantaflow/patches/liquid-performance.patch b/extern/mantaflow/patches/liquid-performance.patch index 6344c249ac5..a62f69adb1f 100644 --- a/extern/mantaflow/patches/liquid-performance.patch +++ b/extern/mantaflow/patches/liquid-performance.patch @@ -16,12 +16,12 @@ index 31e43483b49..9856d84a8b1 100644 - if (tmp(i, j, k) != 0) return; -+ static const Vec3i nb[6] = {Vec3i(i+1, j, k), -+ Vec3i(i-1, j, k), -+ Vec3i(i, j+1, k), -+ Vec3i(i, j-1, k), -+ Vec3i(i, j, k+1), -+ Vec3i(i, j, k-1)}; ++ const Vec3i nb[6] = {Vec3i(i+1, j, k), ++ Vec3i(i-1, j, k), ++ Vec3i(i, j+1, k), ++ Vec3i(i, j-1, k), ++ Vec3i(i, j, k+1), ++ Vec3i(i, j, k-1)}; + const int dim = (vel.is3D() ? 3 : 2); // copy from initialized neighbors @@ -51,12 +51,12 @@ index 31e43483b49..9856d84a8b1 100644 - if (weight(i, j, k)[c] != 0) return; -+ static const Vec3i nb[6] = {Vec3i(i+1, j, k), -+ Vec3i(i-1, j, k), -+ Vec3i(i, j+1, k), -+ Vec3i(i, j-1, k), -+ Vec3i(i, j, k+1), -+ Vec3i(i, j, k-1)}; ++ const Vec3i nb[6] = {Vec3i(i+1, j, k), ++ Vec3i(i-1, j, k), ++ Vec3i(i, j+1, k), ++ Vec3i(i, j-1, k), ++ Vec3i(i, j, k+1), ++ Vec3i(i, j, k-1)}; + const int dim = (vel.is3D() ? 3 : 2); // copy from initialized neighbors diff --git a/extern/mantaflow/preprocessed/fastmarch.cpp b/extern/mantaflow/preprocessed/fastmarch.cpp index 9856d84a8b1..ca8154fd63c 100644 --- a/extern/mantaflow/preprocessed/fastmarch.cpp +++ b/extern/mantaflow/preprocessed/fastmarch.cpp @@ -308,12 +308,12 @@ struct knExtrapolateMACSimple : public KernelBase { { if (tmp(i, j, k) != 0) return; - static const Vec3i nb[6] = {Vec3i(i+1, j, k), - Vec3i(i-1, j, k), - Vec3i(i, j+1, k), - Vec3i(i, j-1, k), - Vec3i(i, j, k+1), - Vec3i(i, j, k-1)}; + const Vec3i nb[6] = {Vec3i(i+1, j, k), + Vec3i(i-1, j, k), + Vec3i(i, j+1, k), + Vec3i(i, j-1, k), + Vec3i(i, j, k+1), + Vec3i(i, j, k-1)}; const int dim = (vel.is3D() ? 3 : 2); // copy from initialized neighbors @@ -715,12 +715,12 @@ struct knExtrapolateMACFromWeight : public KernelBase { { if (weight(i, j, k)[c] != 0) return; - static const Vec3i nb[6] = {Vec3i(i+1, j, k), - Vec3i(i-1, j, k), - Vec3i(i, j+1, k), - Vec3i(i, j-1, k), - Vec3i(i, j, k+1), - Vec3i(i, j, k-1)}; + const Vec3i nb[6] = {Vec3i(i+1, j, k), + Vec3i(i-1, j, k), + Vec3i(i, j+1, k), + Vec3i(i, j-1, k), + Vec3i(i, j, k+1), + Vec3i(i, j, k-1)}; const int dim = (vel.is3D() ? 3 : 2); // copy from initialized neighbors