# Simulate dirt spread (Normal distribution?)

-This question is technically more math related, but it has to do with a simulation so I am here first. I can post this in the math SE instead if needed.

I am in the process of trying out some mesh deformation simulating the effect of sand/dirt being poured in a pile (Think hourglass sand) and I am trying to determine the best way to calculate the spread instead of becoming increasingly taller. I don't intend on actually matching sand/dirt physics, I just want to get my mesh to be somewhat close to the shape that pile would make as it grows.

I'm pretty sure that Normal Distribution is what I want, so in my desmos graph below, think of f(x) -green line- as the current dirt/sand piling up (where I am at in my code) and f1(x) -purple line- as the spread version (what I want to happen instead).

f1(x) is not correct but I think it is pretty close. Essentially i need the area of f1(x) to always equal the area of f(x) but as f(x) gets taller, f1(x) gets wider and taller, but not as tall as f(x).

https://www.desmos.com/calculator/ir8if2u8qq

<a title="View with the Desmos Graphing Calculator" href="https://www.desmos.com/calculator/ir8if2u8qq">  <img src="https://s3.amazonaws.com/calc_thumbs/production/ir8if2u8qq.png" width="200px" height="200px"     style="border:1px solid #ccc; border-radius:5px"  /></a>

I hope this makes sense to you gurus. If not, I can try to clarify more.

Edit: Also, if you open that graph, the slider for variable 'h' is the one im essentially trying to work with.

If you want/need to follow real world physics, the key factor you need is called the critical angle of repose, which refers to the steepest angle of descent or dip relative to the horizontal plane to which a granular material can be piled without slumping. At this angle, the material on the slope face is on the verge of sliding. The value varies depending upon material and conditions is influenced by things such as material density, surface area and shapes of the particles, the coefficient of friction of the material, additions of solvents & electrostatic attraction.

According Thomas Glover's Pocket Reference (used by contractors, engineers), the critical angle of repose for earth is 30 to 45°. As context, the values for dry & wet sand are 34° & 45° respectively. At present, these & other values are available on the Wikipedia entry I linked above.

If you're making a game, there's something to be said for using values that work for your game rather than following real life. Case in point, Mario isn't subject to standard Earth gravity. On the other-hand, if you're building an engineering tool, you should probably check with some engineers.

• +1 for Critical Angle of Repose. That is pretty close to what i was looking for. And no, this definitely doesnt need to be 100% accurate. I am basically just trying to come close to matching the shape the pile of sand would make as it grew. Kinda like if you were to put a blanket (deforming mesh) over that pile of sand at various segments of time. Commented Sep 6, 2016 at 20:10

If you're looking at different symmetrical graphs to simulate a natural thing (like sand piles in your case) then you're doing something wrong.

Sand doesn't work like a math equation. Sand is a particle system. Imagine each sand particle as a separate object with momentum and gravity. Those two plus the friction between 2 particles define how it moves.

Sand moves the same as if you would throw actual rocks on each other. The first hits the ground, maybe bounces a bit, but then stays at a place. The second hits it, loses it's momentum a bit (the other takes it up and some of it becomes heat too), and as gravity dictates, it starts to roll off from it. This happens multiple times. At a point it will be hard to roll off from the already existing small pile because it's big, so one eventually stays at the top of the current pile and it starts over again.

• In my case I am just trying to make fake it by using a deforming mesh to somewhat match the shape the sand would make as it grew. I guess essentially, just think about if you had some blanket over that pile of sand as it grew Commented Sep 6, 2016 at 20:08