I’ve spent a couple of days trying to get a realistic looking sand to flow through an hourglass. But I seem to have more issues and drawbacks than success so I wondered if anyone here had any ideas/solutions. I’ve found no discussions on this topic and the few attempts of others I’ve found on youtube done in blender and other 3D apps is not up to scratch
Firstly, I tried using a fluid simulation but couldn’t get the flow to resemble sand well enough.
Secondly, I tried out using particles, but found that the particles spilled out of the hourglass too much and did not build at the bottom correctly.
My last and most successful idea was to use lots of small cubes placed in the hourglass mesh and use the game engine for a physics simulation. Once the physics are recorded to ipos I then added particle effects to the cubes to generate more cubes to give the appearance of more sand and save on the amount to cubes the physics had to compute. The flow was right, and started to look god. The problem here is that too many of the cubes fell through the hourglass mesh and I’ve not been able to fix this collision issue. Also I need to use smaller cubes, but then even more just fall through instead of colliding.
Any ideas, help or links to information that can get me in the right direction is much appriacted.
For this kind of project, you really need to ask you some questions before. Because there are many solutions that could be appropriate.
Is it animated or still?
If this is animated, what is animated: sand, hourglass, camera, lights, etc.
The sand animation would be physically correct? Stylized but natural?
Where would be the camera, close or far from the houseglass?
For example, you want to do an ocean animated. You can do that with a fluid simulation, but it will be long to tweak, calculate, render but at the end will be realistic. Or you can do that with animated textures and good materials. At the end, according to your shot, the differences may be minimal.
Particles are good for collisions but they can’t shape a stack (which is the base of the hourglass, actually).
Use the game engine could be great because you will have this pile, but you can’t model each grain.
If you need something really precise, a fluid sim with correct settings and material could do the job.
The project is a chess board and to the side is going to be the hour glass with sand slowly falling through. The sand falling is going to be the only part animated. I’d never animated sand in blender before and thought I’d give it a try in some context. The sand flow is planned to be physically correct, with the hourglass slightly off-center and in focus. The view will be as if seen by the player, so the camera will move to check the hourglass and inspect the pieces.
I solved a lot of the collision issues in using the game engine and got some great realistic flow and piles through controlling the friction, but could never model enough to get a decent volume.
Any help on some fluid settings would be a great help. Currently the fluid is placed inside the hourglass (setup as an obstacle) but it does not sit right inside and I cannot seem to get it to flow through the hole the separates the two halves.
From what I understand of your animation, GE sim would be over complicated for the purpose.
Fluid simulation with a low viscosity value (honey preset) could be interesting to test, but I’ve just think at another way, very easy to do and tweak: shape keys in addition with a wave modifier.
Shape keys deform meshes through time, so you can make the sand at the top of the hourglass “move” to the bottom. The Wave modifier will help for the details.
I never thought of combining shape keys with a wave mod. While playing with that idea I decided to incorporate particles for the falling sand, placing the emitter in the narrow pass that separates the two halves and using a simple cube object for particles, killing them on collision, seems to look more real than shape keys and procedural textures alone. I’m working long hours this week so do not as much time as I would like to work on the project. But I will upload something soon (if you like, Richard, I can PM you when I’ve completed a short test animation).
Thank you so much Bupla, your input has been a huge help.
Just a quick test (quick to set up, not bake or render), using fluid simulation + particles. (I made the narrow part of the hour glass a bit too big; also some issues of the “sand” welling up and not piling up properly in the lower section of the hour glass…
The top half looks really good Gimble. How did you get the fluid simulation to work when placed inside the obstacle? Every time I try I get fluid escaping and the fluid will not flow through the narrow pass so just sits in the top half.
The opening “splash” of sand hitting the bottom is great, was that particles or just some fluid splash? If I could get the fluid simulation method to work I was thinking of using an animated control mesh at the bottom to get the sand to build up correctly.
I use a “stand-in object” with a thicker wall to prevent the fluid from passing through.
Also, perhaps I have a wider opening in the middle, I’ve tried again with a narrower opening and it still seems to be working fine. Using a higher resolution may also help, if you have enough RAM to run the fluid simulation.
The opening “splash” was just particles. I was trying to use just particles (with an invisible fluid material), but it seems that you can “only” use a maximum of 10,000 tracer particles, which leaves too much of a gap to look realistic. Using a “multiple sand grain” object causes multiple sand grains to move in unison which looks wrong and also starts to impinge on the glass’s inner wall.
To fix the collision issue, you have to scale your models up by about 100. Yep, that’s right, 100. The bullet library has a floating point problem in collision calculation; it was designed for much larger spaces than an hour glass.
Here’s an example of sand falling properly in an hourglass, with only 2 that get away (press p to play): hourglass.blend (357 KB)
You can record the ipos at a larger size, then parent everything to an empty to scale it back down for animation.
Is there any chance you could post a copy of the blend file Gimble? I’ve never used particles in fluid simulation and rather than ask you to post answers to loads of questions it probably be better for me, learning wise, to figure out and observe what you’ve done. The flow is excellent in that video, but I see what you mean about not being able to get enough particles.
That’s brilliant Blinkozo, something else I found that improved escaping grains was using a simple python script to improve the quality of the physics simulation. Is it possible to use cubes instead of spheres to reduce the amount of verts to get more grains in without compromising collision quality (I’m guessing spheres with more verticies have more faces to check for collision detection - thus resulting in better collisions)?
Saddly, I’m so bogged down with work at the minute I’ve not been able to give the problem the time it deserves and submit my own ideas. I’ve toyed with particles to emulate the flow of sand and I’m beginning to get somewhere, still needs a few tweaks but I’ll upload the results of that approach soon.
As always, thank you so much for your ideas and support.
I believe Blinkozo’s approach is probably the best way to go (with a ramped up sand count).
I also ran into issues with the fluid/particles “sticking” to the top part of the hour glass. Though it might be possible to correct this by tweaking the viscosity and gravity settings.
Very nice work Blinkozo.
I notice that if you activate draw solid for the glass object, It appears that 4 of the lower sand particles are external to the mesh hour glass structure. That’s probably the couple that got away. Though I also had some pass through the bottom. That didn’t happen to you?
Also, would you happen to know if the floating point issue has been resolved in the svn release?
I’m glad this weeks over, now I can get back to blending. Thank you so much Gimble, its been a real help in learning particles in fluid simulation.
If you improve the simulation quality via a python script and lower the gravity (apparently using lower gravity settings improves collision) you can keep almost all the grains in during physics simulation.
I’m currently rendering an attempt using key frames alongside particles and will upload that soon.
I’ve got a couple of vids on youtube, the first one uses just key shapes, in the second I’ve added particles as well. Though I must point out that I am still learning about animation so it’s not the best, also to save on render time I lowered a lot of the render settings.
The animation is not as consistent or even as I would like, but I think it begins to look like a good approach to the problem. I have yet to try a wave modifier as Bupla suggested. My next steps are to produce a version using the GE and go back and spend more time getting the key shapes looking better. The biggest problem with using key shapes I found was getting the opening splash of sand right, perhaps more careful tweaking of particles could do this.
It’s looking pretty good. I guess if you’re not making an extreme close-up of the hour glass, using individual sand grains may be a bit overkill. With a little better texture and lighting, it should look quite good.
On the second animation, it seems as though the particles are being emitted at a regular interval causing a “cork screw” like emission effect. Maybe using a little more random would look better.
I was able to overcome the limited fluid tracer particle count by using multiple domains.
Though I still have a few issues that I couldn’t figure out:
some tracer particles seem to remain static (tried using an obstacle to move them, improved the situation a bit, but not completely)
still has that particles floating in liquid look, and
wow, it’s looking really good. And thank you for the feedback. I see what you mean, but multiple domains does give a better result.The particles sticking could be related to the viscosity (I could be wrong here). I assume your using the honey setting, right? A thicker viscosity is going to cling better, even if the obstacle is set to free. perhaps use a thinner substance like water then slow the animation down to get a thicker feel. Would it be possible to hand tweak the base after baking to model the sand piling up? A final thought, perhaps a few more bakes would go some way to make the particles look less like they’re floating.
Cheers for the input on the particles, I couldn’t figure out how to get particle flow less like a cork-screw, I’ll give that a try.