Friday, September 23, 2016

Creating a Chocolate Fountain Using Viscous Fluids in Houdini

In the creation of the Viscous Fluid project, I decided to create a chocolate fountain. I chose chocolate, as it is a relatively thick flowing liquid.
I gathered my reference and began working to match it from the very beginning.
The goal was to create a thick flowing fluid that would match the speed, reflectivity, and consistency as what is seen in the photo above. I decided it would be fun to attempt dipping something into the chocolate as the strawberry is being put in the chocolate above. For time’s sake, I chose to go with a marshmallow.

I began modeling in Maya to create the chocolate fountain, and decided to give it an extra tier to add to it a little bit.



I created the fluid emitter and decided first to work on correcting the collisions. Despite how complex creating the actual physical fluid is, getting the collisions to work correctly has been one of the more difficult and important parts of Houdini projects in my experience.

In the FlipFluid Object in the Autodop Network, I set the Collisions Volume Offset to 0 and checked “Use Point Velocity for Collisions.”
On the Chocolate Fountain’s Shape itself inside of the Autodop Network, I turned off “Use Volume Based Collision Detection” in the RBD Solver, and set the Geometry Representation Bullet Data to “Concave.” With the Collision Padding and Angular Threshold set to 1 and the Linear Threshold set to 0.8, I found that I got very effective Collisions with the object.




One of the biggest struggles of the project was perhaps the very next step, which was making the liquid emit out of the top of the fountain as though it was being pushed upwards.
After about an hour of finagling and struggling to get it to emit correctly, I finally found the exact perfect placement of the emitter in the top of the fountain.



Set at this height above the Fountain Object, the emitter would emit into the little bowl at the top, the bowl would fill with particles relatively evenly, and they would spill over the edges. If the emitter was set even a fraction of a number higher, they would splash out of the top. If the emitter was any lower, the particles trying to push their way up out of the bowl would fight with the particles falling downward, pressure would seem to build, and the particles would shoot up into the air like a vertical upward fountain.
This exact positioning caused a nearly perfect emission, and this is what I stuck with for the remainder of the project.

After making the fluid Viscous, I turned the Velocity up to the recommended 1000 to get a good amount of thickness in the liquid. When playing back the simulations, I felt it was still too watery, so I turned the Viscocity up to 1200. This gave me, what I felt, was a very good result.



I set the Particle Separation to 0.1, and both the Particle Radius Scale and Grid Scale to a value of 2. This gave me a very good flow.  I did not lower the Particle Seperation because I did not want to increase my render times and simulations, as they were already becoming quite slow. It was giving me a decent look, so I felt good about it.


The next problem I was running into was that when the chocolate was falling from one tier to the other, it was bouncing off of the next tier rather than just landing on it and staying. It wasn’t bouncing a ton, but just enough to make it bypass the next tier after the chocolate fell again. This did not match my reference at all.
You can see in the picture below that the liquid is falling off of the second tier too quickly, and is bypassing the third tier. I needed to find a way to keep that from happening.



The next thing I did to solve that problem was readjust the Density.
I realized that turning down the Density made the liquid fall down straighter and more inward rather than outward, and turning up the value of the liquid did the exact opposite. I found that a Density value of 500 helped out a lot, and decided to keep it there.

Changing the Density helped, but my particles were still not reacting to hitting the surface quite the way I wanted them to. To further fix this, I put a value of 0 in the Bounce Attribute on the Fountain’s geometry.

After changing the Viscosity Scale several times and doing some testing, I found that a Viscosity Scale set at a value of 2 seemed to be the most effective.

The liquid was continuing to bounce just a little bit and wasn’t quite falling the same way the chocolate was, so on the Flip Fluid Object, I set the Bounce to 0, Bounce Forward to 0.9, and Friction to 0.3.

I also wanted to cause the liquid to have only a sleight amount of stickiness without turning on the “Stick on Collision,” so I set Surface Extrapolation to 0.7 and that gave the liquid a perfect amount of stickiness and roll on the fountain’s surface.

To get the Chocolatey look that I wanted, I set the Diffuse color to a mid-level brown, set the Diffuse Intensity to 0.105, and the Roughness to 0.257. I set the Specular Intensity in Reflections to 0.756, with a skin-tone pink as the specular reflection color. The Refraction Intensity was set to 0.01, and the Refraction Minimum set to 0.24. With the Opacity turned up to 1, I got a very good chocolate look upon rendering.

I set the camera up and animated it moving in a circle around the fountain, so you get almost a 360 degree view throughout the rendered final.



I don’t know what my problem was, but for some unknown reason, my files would not Cache properly, therefore I never got a cache that went beyond a couple hundred frames, (and my simulation lasted 500 frames.) So I could not scrub through the scene properly and see what it would look like beginning to end.
Because the chocolate falls perfectly and thickly off the first tier within the first couple hundred frames, I assumed that it would work correctly going down the other tiers.

For other unexplained reasons, Houdini would not allow me to do a Flipbook/Playblast at ALL. I have been able to do them in the past, but this time I was hitting strange errors no matter what I would change in the settings. This was a problem I tried tirelessly to resolve, but could not.


Therefore, I had no clue how it would look all the way through.

This affected me negatively in the final due to how clumpy and goopy it looks near the bottom of the fountain. At the top of the fountain, (the part which I was able to visualize), the chocolate falls in perfect sheets, but not quite so much so near the bottom.

Overall, the render turned out okay, and the whole thing was alright. But I wish I the computing power to render things more quickly and to be able to visualize things correctly before rendering. I did not have this luxury, therefore did not know what the end of the clip and last half of the simulation would look like.

I placed a Distant Light and an Environment light into the scene and put simple materials on all other objects in the scene.

The render took about 17 hours, and by then I knew I did not have the time to correct things, but I know that if I was to return to the project, I may turn up the emission rate, set the Viscocity slightly lower, and turn down the Particle Separation Rate to a lower number.



Overall, I am not extremely happy with the results, but I did learn from the trial and error. 


No comments:

Post a Comment