Commit Graph

70 Commits

Author SHA1 Message Date
Sebastián Barschkis
020d1e23ae Fluid: Fix issue with mesh not being loaded
Fixed an issue that was likely introduced in a past cleanup.
2020-04-08 16:26:20 +02:00
Sebastián Barschkis
c2cb87f897 Fluid: Fix problem with inconsistent noise when using multiple adaptive time-steps
Problem was mentioned in T74062.
2020-04-08 13:27:12 +02:00
Sebastián Barschkis
4a83832120 Fix T74828: Fluid: Crash with Fire/Smoke Noise
Issue was that the noise simulation was trying to bake with a minimized domain size (adaptive domain initializes domain with size (1,1,1)). Similarly to the base resolution bake, there should be no noise baking happening at those domain sizes - a domain at this size is considered empty.
2020-04-07 14:31:33 +02:00
Sebastián Barschkis
ea78f9922e Fluid: Fixed assertion error
Fix for new assertion statements that were introduced in bfdc42d9906a.
2020-04-07 14:31:33 +02:00
Sebastián Barschkis
71a52bbe2a Fluid: Ensure correct velocities for noise bake
Make sure that noise uses the unaltered velocity grid. This is particularly important once external velocities get added to the velocity grid.
2020-04-06 17:48:32 +02:00
Sebastián Barschkis
70b061b4fd Fluid: Refactored caching in main Mantaflow class
This refactor cleans up code for the Manta file IO. It also improves the cache 'Replay' option.
2020-04-03 17:37:37 +02:00
Sebastián Barschkis
bfdc42d990 Fluid: Refactored MANTA class
Refactored the caching system so that return values are no longer ignored. The aim of this refactor was to make the caching more robust.
2020-04-03 17:37:25 +02:00
Campbell Barton
04fe37f931 Cleanup: quiet shadow warnings with ghost & mantaflow 2020-04-03 16:15:57 +11:00
Sebastián Barschkis
1280f3c0ae Fluid: Optimization for mesh file loading
Improved loading times for mesh files by reading bigger chunks of data from the disk at once.
2020-03-30 17:32:38 +02:00
Sebastián Barschkis
7d59f84708 Fluid: Optimization for liquid / secondary particle file loading
Improved loading times for particles files by reading bigger chunks of data from the disk at once.
2020-03-29 21:31:20 +02:00
Sebastián Barschkis
5cf6689019 Fluid: Removed obstacle levelset optimization
Currently results in unstable particle behavior and incorrect meshing.
2020-03-27 00:16:34 +01:00
Sebastián Barschkis
04ab677761 Fluid: Small fix for secondary particles
Small tweak to ensure index will not run out of bounds during secondary particle computation.
2020-03-25 16:08:05 +01:00
Sebastián Barschkis
cda81d5a4d Fluid: Enforce minimum thickness to planar flow / effector objects
Planar object now have a thickness by default. This should make it more intuitive for users as there is no need to specify an object thickness.
2020-03-23 23:50:39 +01:00
Sebastián Barschkis
e9629e3cfd Fluid: Use different phi for levelset generation
Phi that is used for mesh should be the one that matches particles best.
2020-03-23 23:50:39 +01:00
Sebastián Barschkis
0c571db4ad Fix T73988: Mantaflow fluid simulation - Particles for Spray, Foam and Bubbles are one frame ahead of Mesh
Fixes an issue with secondary particles being out of sync with the main simulation. Cleaned up the secondary particle code in general too (making sure that all solver attributes - timestep, framelength, etc. - are set correctly).
2020-03-22 21:46:43 +01:00
Sebastián Barschkis
7f3e84deb5 Fluid: Updated manta pp files
Includes only a rename. The name PyInit_Main was a bit confusing as it just belongs to Manta.
2020-03-17 11:57:04 +01:00
Sebastián Barschkis
93ac4709eb Fluid: Potential fix for Eevee tests crashing with Mantaflow
Belongs to T73921. This commit fixes the crashes with light baking (disabled in f3a33a92987f). There is still a memory leak to be fixed though.
2020-03-13 15:34:07 +01:00
Brecht Van Lommel
c8acb6dd6c Smoke: put density/color in separate textures, fixes for workbench shader
This is more in line with standard grids and means we don't have to make
many special exceptions in the upcoming change for arbitrary number of volume
grids support in Eevee.

The workbench shader was also changed to fix bugs where squared density was
used, and the smoke color would affect the density so that black smoke would
be invisible. This can change the look of smoke in workbench significantly.

When using the color grid when smoke has a constant color, the color grid
will no longer be premultiplied by the density. If the color is constant
we want to be able not to store a grid at all. This breaks one test for
Cycles and Eevee, but the setup in that test using a color without density
does not make sense. It suffers from artifacts since the unpremultiplied
color grid by itself will not have smooth boundaries.

Differential Revision: https://developer.blender.org/D6951
2020-03-11 14:42:46 +01:00
Brecht Van Lommel
81c18c2507 Fix part of T73921: hang with Eevee light baking and Mantaflow
Now it crashes instead.
2020-03-09 17:11:24 +01:00
Sebastián Barschkis
5539b68009 Fluid: Optimization for smoke simulation (multigrid)
The solver will now automatically detect static scenes (no moving obstacles) and use a slightly faster pressure solve in those cases.
2020-03-07 19:57:06 +01:00
Sebastián Barschkis
b4f1edd98b Fluid: Revert bc2ce31d7940 (changes to open boundaries)
Changes from that commit turned out to be unstable.
2020-03-06 15:01:30 +01:00
Sebastián Barschkis
950a35e353 Fluid: More optimizations in smoke / liquid scripts
Reduced extrapolation distances, no need to extrapolate that far.
2020-03-05 14:22:51 +01:00
Sebastián Barschkis
cd0a6ff5c4 Fluid: Diffusion settings now optional
For optimization purposes these settings need to be enabled explicitly from now on.
2020-03-05 12:36:00 +01:00
Sebastián Barschkis
4ccbbd3080 Fix T74446: Liquid Inflow Does Not Work
Somehow this was forgotton in the optimization patch a5c4a44df67e.
2020-03-05 11:41:09 +01:00
Sebastián Barschkis
a5c4a44df6 Fluid: Bounding boxes for effector objects
This commit adds bounding box support for emission objects - similarly to flow objects. Before, each effector object had to iterate over the entire domain. Bake times of scenes with multiple obstacles improved significantly with this optimization.

Other improvements that were implemented alongside the bbox feature:
- Option for subframe sampling for effector objects
- Option to enable / disable effectors (can be animated)
- Optimization for static objects. If a flow or effector object does not move and the adaptive domain is not in use, the bake time will be optimized further by reusing the flow / effector grids from the previous frame (no recalculation).
2020-03-04 18:46:48 +01:00
Sebastián Barschkis
3c74d45c9e Fluid: Added sanity grid initializations in smoke / liquid scripts
Just a sanity check.
2020-03-04 18:46:48 +01:00
Sebastián Barschkis
bf8a73b4a7 Fluid: Naming cleanup for flags grid
Use flags instead of obstacle to avoid confusion with obstacle levelset grid.
2020-03-04 18:46:48 +01:00
Sebastián Barschkis
6958ec3f7f Fluid: Added an option to delete fluid inside obstacles
Simple checkbox that - if enabled - will tell the solver to clear density or liquid particles in obstacle cells.
2020-03-04 18:46:48 +01:00
Sebastián Barschkis
b32fd73b24 Fluid: Optimization for extrapolation functions in smoke / liquid scripts
Too much extrapolation can become expensive. Reducing it here since extrapolating levelsets into a couple of cells should be sufficient.
2020-03-04 18:46:48 +01:00
Sebastián Barschkis
bc2ce31d79 Fluid: Improved behavior at open boundaries
Use greater boundary width for smoke simulations
2020-02-28 16:20:13 +01:00
Brecht Van Lommel
9085b7e847 Fix OpenVDB link error on Windows after recent changes 2020-02-26 19:24:20 +01:00
Brecht Van Lommel
78391def6e Cleanup: deduplicate OpenVDB library definitions/include/libs logic
This will more important when we start using OpenVDB in more modules.
2020-02-26 18:13:14 +01:00
Julian Eisel
fc81eb74e7 Mantaflow: Address precompiler warning and related cleanup
* Address warning because of undefined OPENVDB usage
* Remove unused WITH_FLUID definitions

Differential Revision: https://developer.blender.org/D6919
2020-02-24 13:01:13 +01:00
Sebastián Barschkis
888d180164 Fluid: Updated manta pp files
Updates in the files include:
- New manta files now use an platform independent gzopen function
- Adjusted argument name for vorticity
2020-02-19 18:58:48 +01:00
Sebastián Barschkis
8c5e36d0a9 Fluid: Fix typo that was made in 4453509d83dc 2020-02-19 15:33:36 +01:00
Sebastián Barschkis
4453509d83 Fix T73770: Mantaflow is unable to bake fluid simulations on non-ASCII file paths
Some fluid cache functions were not using Blender's more secure BLI_gzopen() function. On Windows there are some special cases which this function can handle compared to the plain gzopen().
2020-02-19 15:07:54 +01:00
Campbell Barton
60890ccf9d Fix T73862: Fluid Sim file handle resource leak 2020-02-17 16:04:04 +11:00
Sebastián Barschkis
d6d44ccc77 Fluid: Inflow object improvements
Various fixes for smoke / fire flow objects:
- Apply inflow at every subframe (new: also emit during adaptive steps in between frames)
- Fix issue with fire not being emitted on first frame
- Higher value range for smoke flow density variable
2020-02-14 14:22:36 +01:00
Ray Molenkamp
75a5ea01c1 Cleanup/MSVC: Enable C++ conformance mode on compiler versions that support it.
MSVC has a conformance mode (/permissive-) where the C++ standard is more strictly
enforced. This mode is available on MSVC 15.5+ [1]

This patch enables this mode on compilers that support it and cleans up the few violations it threw up in the process.

- Mantaflow was using M_PI without requesting them using the _USE_MATH_DEFINES define to opt in to non default behaviour.
- Collada did not include the right header for std::cerr, this seemingly was fixed for other platforms already but put inside a platform guard.
- Ghost had some scoping issues regarding uninitialized variables and goto behaviour

Second landing of this patch, earlier commit was reverted due to some compiler configurations having slipped though testing

[1] https://docs.microsoft.com/en-us/cpp/build/reference/permissive-standards-conformance

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

Reviewed By: brecht
2020-02-13 17:13:07 -07:00
Ray Molenkamp
6022cd015f Revert "Cleanup/MSVC: Enable C++ conformance mode on compiler versions that support it."
It is breaking compilation on some configurations, revert for now while
i see what is wrong.

This reverts commit 9fe469c110940af5d2525158305d5d365bd15276.
2020-02-13 07:04:30 -07:00
Ray Molenkamp
9fe469c110 Cleanup/MSVC: Enable C++ conformance mode on compiler versions that support it.
MSVC has a conformance mode (/permissive-) where the C++ standard is more strictly
enforced. This mode is available on MSVC 15.5+ [1]

This patch enables this mode on compilers that support it and cleans up the few violations it threw up in the process.

- Mantaflow was using M_PI without requesting them using the _USE_MATH_DEFINES define to opt in to non default behaviour.
- Collada did not include the right header for std::cerr, this seemingly was fixed for other platforms already but put inside a platform guard.
- Ghost had some scoping issues regarding uninitialized variables and goto behaviour

[1] https://docs.microsoft.com/en-us/cpp/build/reference/permissive-standards-conformance

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

Reviewed By: brecht
2020-02-12 12:49:34 -07:00
Campbell Barton
3e6e9ce01b Cleanup: extra semicolons, comma use, undeclared vars 2020-02-11 12:04:50 +11:00
Sebastián Barschkis
5e30bd43f8 Fluid: Optimization for fluid domain obstacle boundary handling
This fix should especially improve liquid obstacles boundaries, i.e. help with the problem of particles sticking to the surface.
2020-02-09 17:25:00 +01:00
Sebastián Barschkis
a048354e9f Fluid: Fixed file formats for script exporter
File formats in the exported scripts were using hardcoded file extensions and not the ones specified in the UI.
2020-02-09 17:17:24 +01:00
Sebastián Barschkis
86e24ea10c Fluid: Fixes for fluid guiding
Fluid guiding functionality was broken in the bake / read cache loop in fluid.c. Committing this to the release branch as otherwise fluid guiding would not have worked as expected (i.e. not at all).
2020-02-09 17:15:41 +01:00
Sebastián Barschkis
68221b7eba Fluid: Fixed cache reading issue with larger resolution noise grids
Important fix that needs to go into the release. The upscaled noise cache was not read into upscaled grids.
2020-02-07 19:37:44 +01:00
Sebastián Barschkis
ffcccf654c OpenVDB: Added missing macros in fluid wrapper file
These were needed to compile when WITH_FLUID=1 and WITH_OPENVDB=0.
2020-02-07 15:19:17 +01:00
Sebastián Barschkis
f12b4e53aa Fluid: Fixed try/catch exception issue and unsed variable issue
Sergey just pointed this out, fixing in it the release branch to avoid any compilation issues during the actual release. Thx!
2020-02-07 11:02:55 +01:00
Ray Molenkamp
763f117c48 Fix: Build error on windows in bf_intern_mantaflow
bf_intern_mantaflow lacked the `-DOPENVDB_STATICLIB` define
causing it to dynamically import openvdb, linked against
our static libs a happy time was not had by the linker.
2020-02-06 13:44:30 -07:00
Sebastián Barschkis
1bb702df1e OpenVDB: Fix IOError in try catch statement
Broader exception handling for OpenVDB IO errors.
2020-02-06 17:24:09 +01:00