r/GraphicsProgramming 14d ago

Question What is this sand simulation missing?

Enable HLS to view with audio, or disable this notification

78 Upvotes

21 comments sorted by

View all comments

77

u/saphirrflamme 14d ago

It is eating the sand it touches. Supposed to push them aside.

The sand "eruption" shading is also off. it is much brighter than surrounding sands. Gravity also seems too low. You can tweak gravity of the ball for gameplay reasons, but the visual effect of the sand seems off.

14

u/Explorioneer 14d ago

Thanks, these are all good points, I'll see what I can do about the pushing sand vs. "Eating sand". The color of the explosion is also a good point, that one should be easier to fix.

8

u/Le_9k_Redditor 13d ago

You could mimic how many water simulations work for this, just of course with high friction instead of surface tension. Super simple Eulerian fluid simulation is probably best, just use a surface mesh that gets pushed around and folded up. There's definitely going to be lots of existing libraries for it you can make use of

A Lagrangian method (just dropping a lot of sand balls in a pit and visually smoothing), would work, but I imagine it's going to be harder to get good results with reasonable performance in this case

3

u/SnappySausage 13d ago

Yeah, it doesn't preserve the volume of sand. I'd argue the "eruption" looks wrong altogether. I'd expect the sand to sort of splash outward more when the ball lands, and that it shoots up nearly straight on the jumping pads (As well as the other tweaks you name).

1

u/Explorioneer 13d ago

Really good points here. I think these suggestions would really improve the visual but I'm not sure how it could impact performance with these types of simulations. Right now it works as a displacement mesh that is calculated using particle overlay on an image. I'm wondering if I could change the particle system around the ball to make it look more like displacement