Categories
Blog simulation Visual Effects

Understanding Turbulence

If you have ever touched houdini pyro you would have noticed in the shape tab there is the turbulence and disturbance settings. Have you ever wondered what is turbulence and what is disturbance? They both add noises and details to the simulation but what is the difference? 

From what I can gather, disturbance doesn’t really exist in real life. By that I mean in real life the physics of gaseous fluids does not have a component called disturbance, there is just turbulence.

I suppose the reason for houdini to include the concept of disturbance in addition to turbulence may be due to the difficulty of solving for turbulence properly, if fact we still don’t know how to solve it. We can approximate to a good degree as to what the fluid will do but we don’t have a “solution” per se.

In order to understand disturbance we have to understand turbulence first. It seems a bit strange to us houdini artists because turbulence and disturbance are two separate operations in pyro. Not so in real life, and as our goal is here try to replicate real life as best as we could, it is paramount that we understand real life.

Turbulence is defined as “departure in a fluid from a smooth (laminar) flow”, meaning to us adding noise or, for a lack of better terms, disturbance to the flow. Turbulence is characterized by the presence of irregular eddying motions (vorticity).

We also need to understand Reynolds number (Re). Reynolds number indicates the ratio of inertial forces (velocity) to viscous forces (surface tension) within a fluid which is subjected to relative internal movement due to different fluid velocities. Which means, the higher the Reynolds number, the more chaotic or turbulent a fluid is. 

The equation for RE is as follows:

ρ is the density of fluid, u is the flow speed, L is characteristic dimension, and μ is the viscosity. This will come into play later.

Cigarette smoke is a very common example of this laminar vs turbulent example. In calm air the smoke is initially smooth and very uniform (laminar), and then at some point it begins to break down and transition into turbulent flow.

Now that we have the idea of laminar flow vs turbulent flow, we will look a bit more into turbulent flow as that is what we are most interested in. Turbulence has three features, eddying motions, chaos and diffusion. 

Diffusion is the easiest to understand, as turbulence is a chaotic process it naturally likes to diffuse to tend towards rest if no energy is added, that dissipation is mostly through heat. In our simulations however we can simply add a drag or multiply down the velocities, easiest enough to do and everyone understands.

Eddies are circular motions, vortices as we call it in the simulation, it is also the motion that is boosted when you increase confinement. Eddies are the main component of what we think of as turbulence, they also come in many sizes, from very large, think hurricanes and tornadoes, to very small, think cigarette smoke or candle smoke. Turbulence parameter in the pyro is trying to simulate this phenomena. 

Chaos is the unpredictability of the evolutions of the eddies due to initial condition, not so much the chaos as we think of like how messy things are. It also means it is really hard to predict what is going to happen to fluids, especially at a smaller scale, and to us this point is rather useless since predictability is what we are looking for in our work.

We can see the most important component for us is the eddies. The hard part is the ability to replicate these eddies at many different scales. Turbulence in our pyro solver is great at replicating larger scale eddies. The issue here is larger eddies carry a lot of energy and as they dissipate that energy they become smaller and smaller in size, that size transition is missing in our turbulence in houdini pyro simulation. 

The other problem with turbulence in houdini is a constant addition of energy. That is why I think turbulence is good at the start of a simulation to create an interesting shape after which should be turned off so as to not inject too much energy which could result in the simulation feeling “alive”. Or we have to control the addition of turbulence very carefully, as we shall see later.

Turbulence takes care of the large scale eddies. What do we do about the smaller ones? This is where disturbance comes in. In pyro we have this node called gas disturb, which is what the pyro solver is using as well. In the documentation it says “The disturbance operator applies noisy forces to the velocity field, mimicking the effects of localized environmental change. This localized change in momentum cancels itself out over time” it is also exactly what turbulence does in real life. The overall energy in the system should eventually cancel itself when no extra energy is added. 

We will take a look at all of this in an example. Cigarette smoke is a good example, it may seem simple but it clearly demonstrates the transition from laminar to turbulent flow.

To start we want to create a simple smooth flow of smoke rising. 

Here we can see other than the initial puff it is fairly smooth.

We can add turbulence to the whole thing to get the smoke disturbed early, but that means we will lose the nice smooth flow of our smoke. 

here we can see it’s getting turbulence everywhere, our smooth flow in the beginning is getting undesirable breakup.

We need to find a way to control the smoke breakup. According to Reynolds equation increasing flow speed increases Reynolds number which increases turbulence, increase the temperature resulting in a faster rising fluid.

If we increase the flow rate enough (increasing speed) or let the sim run for long enough time eventually we will see the smoke break up. Of course in real life smoke will do what the smoke wants but that is not gonna fly for us, what if the art director or supervisor wants us to start the turbulence earlier.

Turbulence in pyro solver gives us some control fields however it’s not the right sort of control, by default it is either based on density or temperature which isn’t what we are looking for. To emulate real life as close as we can we need to be able to control turbulence based on velocity, however vel field in pyro is a vector field and is not able to be used as a control field, not as far as I know anyway but I could be wrong there. It’s better  to use magnitude of velocity instead. We can easily calculate magnitude of vel by using the length function in houdini, but we need to create a vmag field to store that value first and also create a gasmatchfield to match vmag to vel, then we will simply use a volume wrangle to calculate the length of vel. 

Armed with this control we can specify when turbulence kicks in based on the velocity of our fluid, gives us complete artist control, and feels real enough. One last step we need to do is to add in a bit of disturbance for that fine detail and we are done! Grab the hip file here!

What we do as fx artists is not to simulate real life one to one, but to create a version of reality that feels plausible but at the same time is interesting, controllable and I think the most important looks how we think it should look. By learning how real life works we gain the ability to understand what makes something look and feel real and that is the base of everything else we do. We can’t possibly hope to create a convincing effect if we don’t even understand why something looks a certain way ourselves. 

I will be creating more of these posts as I dig deeper into every aspect of fx work. There is always more to learn no matter how experienced on might be and there is always room for improvement.

Further reading:

http://www.astronomy.ohio-state.edu/~ryden/ast825/ch7.pdf http://www.astronomy.ohio-state.edu/~ryden/ast825/ch1-3.pdf

Categories
Blog Rendering simulation Visual Effects

Explosions

Some explosions I had whipped up from some personal testing and development.

The few things I really wanted to work on is getting lots of internal detail, developing the internal light scattering of the explosions, also working with sparse grids.

Categories
Blog

COVID-19

I am lucky enough to be working for a company that values its employees enough to give us the ability to work from home during this trying period. 

It’s not easy to be able to let hundreds of people work from home, and the hit on productivity must be substantial. I, however just want to express my appreciation for the company who thinks not only of work and money but of their employees as well. 

Other heros we have to thank too are the IT and facilities personnel who has to be on location to make sure things are running smoothly while everyone is away. Keeping the power on, restarting unresponsive machines and the plants watered. 

Last but not least the production and management team who has to work much harder to keep everything running as smoothly as they possibly can. It was not an easy task when everyone was sitting together, it would be at least 10 times harder now with everyone spread out so far. 

While we stay home and try to go out as little as possible we also need to make sure to keep an eye on the news but be aware of misinformation. 

If you want to learn a bit more about the disease and potential prevention methods I would highly recommend Dr John Campbell: https://www.youtube.com/user/Campbellteaching I have been watching his videos since the turn of the new year and he has presented information based on the best available facts and made observations and predictions that has since came to pass, and he also has made recommendations to minimize the chance of contracting the disease. 

Stay safe, stay calm and stay awesome. 

Categories
Blog Rendering simulation Visual Effects

Balls falling

I have been spending some time with the /r/simulated subreddit, in fact it is the very thing that had inspired me to come back to doing the blog and learning more about houdini.

It is hard to find the inspiration to work on more stuff after working all day. However I want to do something cool and learn about what I am interested in.

Right now I want to do a bit more motion graphics type of stuff. Let’s start with this ball falling. Simple stuff but a decent project to get my feet wet.

Not extremely complex but a good place to start is anywhere. Get the ball rolling so to speak. That is also something interesting in life in general, it’s hard for us to start because we think too much, or want to achieve too much too fast and that overwhelms us.

A simple setup, when copying the spheres make sure to have orient so they are not rotated the same way, it’s easy to forget when copying sphere.

Also setup the constraints with 0 restlength so the spheres would bunch up.

To stay with the /r/simulated idea of not having to animate anything this line of vex was used to push the spheres away to create a “seamless” gif (which i forgot to take into account the shadows).

Here you can clearly see the constraints at work. I didn’t bother removing the constraints as the forces pushing the spheres apat is strong enough to overcome the constraints and the simulation is short enough.

Categories
Blog Random Visual Effects

Long time!

It has been a long time since I last posted anything here. I started this blog to document my journey to become an fx artist.

The journey hasn’t ended but i’ve just gotten too busy to worry about updating the blog. I still learn stuff and still work on a lot of stuff. It is just hard to find the time to write stuff into blogs. I want to get back into it.

However, I want to start this again. It is beneficial to me to document what I have learned, and have a place to keep all the materials.

I also realized through teaching, yes i currently teach a few classes at a college, that keeping all of the stuff i have done is really beneficial because when i need to refer to something that was done previously i have a place to go and i want this blog to be that place. a place to keep my sanity and to document my descent into madness.

A little update first. worked on a couple of things you may have heard of, the mandalorian perhaps? midway maybe? star trek discovery possibly? the boys i assume? been very much blessed to be able to work on those shows and had a blast while doing it too. check out my IMDB: https://www.imdb.com/name/nm3017328/

I have moved on from pixomondo, thank you pixomondo and all my friends there for the amazing 3 years, to tangent animation to get more balance in my life due to the arrival of a certain adorable little human. The plan is to do more projects on my own now that I have a bit more time at home and while the little human sleeps I will work on some personal project where I can learn and explore.