NVIDIAGameWorks / FleX

Other
668 stars 100 forks source link

granular particles in Flex behaving oddly - sleepThreshold bug? #127

Closed jlinBE closed 2 years ago

jlinBE commented 2 years ago

Hi,

I am working on a granular material simulation using Flex (see screenshot).

draw_ellipsoid_leaning

Clip plane:

image

In the screenshot, I fill a volume with solid particles, and let a set number fall through an aperture at the bottom. Then I restore the particles to their initial positions, and color the particles that fell through the aperture. Undrawn particles are subsampled to make the picture easier to see. This gets me the 'ellipsoid of draw'.

The problem is that it leans to one side, when it should be perfectly straight. The lean is always towards the origin (the three green boxes on the bottom left corner). I think the problem comes with the sleepThreshold parameter - the lean seems to be worse with higher values of this.

I really don't want to just set sleepThreshold to zero, because higher sleepThreshold makes the ellipsoid of draw taller/narrower, which is more realistic.

Any idea what's causing this? Far as I can tell, sleepThreshold rolls particles back to their positions at the beginning of a timestep if their velocity is below a certain cutoff? Could it be this check is applied separately on the X,Y,Z axes instead of the euclidean distance?

Let me know if you need further info.

p.s. here are some movies of the simulation:

The same ellipsoid as the screenshot, but animated: https://www.dropbox.com/s/q0pterd223ncwnt/R21_draw_ellipsoid.mp4?dl=0

Colored by velocity, with slow-moving particles removed: https://www.dropbox.com/s/gq62om5yagxmrio/R21_velocity.mp4?dl=0

Colored by displacement from initial position: https://www.dropbox.com/s/q4bkcnxovck0c0k/R21_displacement.mp4?dl=0

jlinBE commented 2 years ago

nevermind - it turned out to be due to the initial packing being non-symmetrical.

Here's what it looks like with symmetrical cubic packing:

Clipboard01 re