[Bf-blender-cvs] [6524aaf6856] blender-v2.83-release: Fix T76008: Fluid inflow with negative initial velocity is not working

Jacques Lucke noreply at git.blender.org
Thu Apr 23 15:05:06 CEST 2020


Commit: 6524aaf685638ef5f9fdca03ae682a0b4d18c6f6
Author: Jacques Lucke
Date:   Thu Apr 23 12:44:12 2020 +0200
Branches: blender-v2.83-release
https://developer.blender.org/rB6524aaf685638ef5f9fdca03ae682a0b4d18c6f6

Fix T76008: Fluid inflow with negative initial velocity is not working

This is a regression introduced in rBa0fe22095e6d9b8b194c2cf6f9a7c7b419d7e61c.

I changed it so that the velocity with the highest magnitude is considered and
not the highest value per coordinate.

Reviewers: sebbas

Differential Revision: https://developer.blender.org/D7502

===================================================================

M	source/blender/blenkernel/intern/fluid.c

===================================================================

diff --git a/source/blender/blenkernel/intern/fluid.c b/source/blender/blenkernel/intern/fluid.c
index a26feb2d06b..83a431306f4 100644
--- a/source/blender/blenkernel/intern/fluid.c
+++ b/source/blender/blenkernel/intern/fluid.c
@@ -3110,9 +3110,19 @@ static void update_flowsfluids(struct Depsgraph *depsgraph,
                                   levelset,
                                   emission_in);
               if (mfs->flags & FLUID_FLOW_INITVELOCITY) {
-                velx_initial[d_index] = MAX2(velx_initial[d_index], velocity_map[e_index * 3]);
-                vely_initial[d_index] = MAX2(vely_initial[d_index], velocity_map[e_index * 3 + 1]);
-                velz_initial[d_index] = MAX2(velz_initial[d_index], velocity_map[e_index * 3 + 2]);
+                /* Use the initial velocity from the inflow object with the highest velocity for
+                 * now. */
+                float vel_initial[3];
+                vel_initial[0] = velx_initial[d_index];
+                vel_initial[1] = vely_initial[d_index];
+                vel_initial[2] = velz_initial[d_index];
+                float vel_initial_strength = len_squared_v3(vel_initial);
+                float vel_map_strength = len_squared_v3(velocity_map + 3 * e_index);
+                if (vel_map_strength > vel_initial_strength) {
+                  velx_initial[d_index] = velocity_map[e_index * 3];
+                  vely_initial[d_index] = velocity_map[e_index * 3 + 1];
+                  velz_initial[d_index] = velocity_map[e_index * 3 + 2];
+                }
               }
             }
           }



More information about the Bf-blender-cvs mailing list