Obi Official Forum
Sand-like properties - Printable Version

+- Obi Official Forum (https://obi.virtualmethodstudio.com/forum)
+-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html)
+--- Forum: Obi Fluid (https://obi.virtualmethodstudio.com/forum/forum-3.html)
+--- Thread: Sand-like properties (/thread-3545.html)



Sand-like properties - danik9 - 31-07-2022

I want to simulate sand. Kind of stylized. Think on Gaara sand visuals or the sand-falls from Journey game.

I'm thinking for the effect I want I should not use a granular blueprint.

How should I set the properties of a fluid blueprint to achieve the closest feel and texture.

Is it possible to control the angle of repose of a fluid with obi?

Best regards.


RE: Sand-like properties - josemendez - 01-08-2022

(31-07-2022, 11:22 PM)danik9 Wrote: I want to simulate sand. Kind of stylized. Think on Gaara sand visuals or the sand-falls from Journey game.

I'm thinking for the effect I want I should not use a granular blueprint.

Hi!

Technically, sand is a granular material: an aggregate of many very small rigidbodies. However this makes it extremely costly to simulate very fine granulars like sand. To maximize the amount of particles used to represent a granular, your best bet is to use an hybrid lagrangian-eulerian approach like MPM or PIC/FLIP, but even then it will be a prohibitively costly simulation.

(31-07-2022, 11:22 PM)danik9 Wrote: How should I set the properties of a fluid blueprint to achieve the closest feel and texture.

Fluid simulation is not really suitable for granulars: you would need to have very small neighborhoods and better incompressibility guarantees, which makes it extremely costly to solve. At this point you're better off using actual granular simulation, but as stated above even then it's too costly to simulate sand. You can use it for gravel, pebbles, but not sand.

(31-07-2022, 11:22 PM)danik9 Wrote: Is it possible to control the angle of repose of a fluid with obi?

No, this concept is exclusively used when dealing with granulars. Fluids do not have an angle of repose, since they're not solids and have no "rest shape".
https://en.wikipedia.org/wiki/Powder#Comparison_with_other_substances

Quote:A liquid flows differently than a powder, because a liquid cannot resist any shear stress and therefore it cannot reside at a tilted angle without flowing (that is, it has zero angle of repose.) A powder on the other hand is a solid, not a liquid, because it may support shear stresses and therefore may display an angle of repose.

Wrapping up: you cannot use Obi to accurately simulate a large amount of sand. If you want accurate sand, your best bet are hybrid cell/particle methods, which are still too costly unless all you have in your game is sand.

Alternatively, you could use cellular-automata. This technique is rather old, not really physically based, but extremely simple and cheap. You can see it used in most "powder-toy" like apps and some games like Noita.


RE: Sand-like properties - danik9 - 01-08-2022

Thanks you for the insight!

What if I would only want to simulate moving (by magic means) sand and any resting or static sand would be simulated by other methods.
Very thin dust and smoke would be simulated by particles sprites

Would could I use obi to approach the look and feel of falling and floating sand? I suposse that's the question. 

Also can I use ObiFluidRenderer with granular blueprints? I think I can't because the project crash Lengua


RE: Sand-like properties - josemendez - 01-08-2022

(01-08-2022, 09:08 AM)danik9 Wrote: Thanks you for the insight!

What if I would only want to simulate moving (by magic means) sand and any resting or static sand would be simulated by other methods.
Very thin dust and smoke would be simulated by particles sprites

Would could I use obi to approach the look and feel of falling and floating sand? I suposse that's the question. 

Falling/floating sand grains do not interact/collide much with each other, or at least their interaction does not have any contribution to the overall look. So at this point, it doesn't make sense to use Obi. It would be far cheaper to use particles that do not interact with each other in any way, which is what 99% of games do for sand. You can use Unity's built-in particle system or VFX graph if you need thousands of particles. Using curl noise to make them flow around in a "magic" way (kinda like Gaara controlling sand) is cheap and looks cool.

For piling sand, the usual approach is to count how many particles hit the ground and either create a "pile" mesh that grows as more particles hit the ground  (or, if you have a terrain-like height map, just increase the height at the impact point). This is dirt cheap (no pun intended) and it looks convincing enough for most purposes. Most earth-moving simulators, both game-like and professional ones, use this combination of simple particles+heightmaps to simulate piling sand:
https://youtu.be/wrYa4JPXoAA?t=38
https://youtu.be/lq1vSduBeMc?t=130
https://youtu.be/4ZaBQHNU1WI?t=97

In the third video, you can briefly see Obi granular particles being used during excavation, since the requirement was to have large-ish rocks more than fine sand.

(01-08-2022, 09:08 AM)danik9 Wrote: Also can I use ObiFluidRenderer with granular blueprints? I think I can't because the project crash Lengua

You should be able to, the fluid renderer just takes particles as input and doesn't care about the type of particles as it only uses their shape and color. I've tried this and it works ok, could you post your crash log?


RE: Sand-like properties - danik9 - 01-08-2022

Thanks for your elaborated answers. They really are food for thought.

I will dm you the crash log.

I want to clarify that I'm looking for the sand to have physics to, for example, block incoming projectiles, so It can't be only build in particles.
I will keep on thinking on this Gran sonrisa