fluid-engine-dev: Moving particle emitter problems
I have found that if I move the Surface3 for a particle emitter (used in FLIP or PIC) then the particles don’t get emitted.
I have tracked this down to the region BoundingBox calculated in VolumeParticleEmitter3::emit(…)
Specifically this code here
BoundingBox3D region = _bounds; if (_implicitSurface->isBounded()) { BoundingBox3D surfaceBBox = _implicitSurface->boundingBox(); region.lowerCorner = max(region.lowerCorner, surfaceBBox.lowerCorner); region.upperCorner = min(region.upperCorner, surfaceBBox.upperCorner); }
Since my moving emitter is an implicit surface created from a Sphere this code runs. It then calculates the lowerCorner of my box to be greater than the upperCorner.
This means that in the forEachPoint method
_pointsGen->forEachPoint(...)
It can’t loop over the points in the box because lower.x > upper.x. Which means that this
double boxWidth = boundingBox.width();
Produces a negative number, so no points are emitted.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 25 (25 by maintainers)
Commits related to this issue
- fix: Force-update BVHs when updating query engine - See doyubkim/fluid-engine-dev#268 — committed to CubbyFlow/CubbyFlow by utilForever 4 years ago
@kentbarber I was also heading to the same route. I also have a compact repro case as well. Thanks for tracking this!
I also have the following set for the emitters, which is the same as in your examples files.
emitter->setPointGenerator(std::make_sharedjet::GridPointGenerator3());
I noticed above that you didn’t set this, so in your test you would have been using BccLatticePointGenerator.
AllowOverLapping is set to the default, so it will be false. And the other differences is that the sphere is being translated every update. This is the main difference, the sphere is moving. When its moving it doesn’t emit particles. When it’s static it does.
I will see if I can produce a cut down version of the code that reproduces the issue for you tomorrow.
Forgot to mention that the SPH issue happens even when the emitter is not moving.
But with the FLIP solver when the emitter is not moving (ie Surface3 is not being translated) then it emits fine. But when it is moving, when I translate the Surface3 before the solver update, then it doesn’t emit.
Sorry I may be mixing up multiple issues here. But my main issue right now is the moving emitters. Hope some of this helps you hunt down the problem. Really enjoying working with the engine again.