Coffee Study: Coffee Swirl
- Jonathan Jankowiak
- Apr 7
- 3 min read
For this Study, we took time to explore one of the best moments when making coffee (especially iced). The Cream swirl!
We also added the second half of the shot, but it's not too important or unique to dive into.
This study was a lot more fun because now we were able to get out of Still Life's and get into the meat and potatoes of what Houdini has to offer!
The Challenge:
One of the early challenges that we encountered was shading. We had a good coffee shader that we were able to balance nicely inside the espresso martini as well as the black coffee, but we couldn't see the cream too well or it looked too dense in the final layered render, even when the cream was pushed up against the glass. The immediate answer was to tweak the coffee shader, but we had the coffee working in most scenarios and we couldn't risk needing to adjust shaders every time there was an issue.
The other main issue was that we wanted a swirling motion but wanted to avoid the "ink drop" look, as we felt it was thinner and more like a simple syrup than cream. We were looking at different ways to achieve the cream pour. Logically, we would use a "flip" or water simulation, but there is also the possibility of having a "pyro" or fluid simulation.
Challenge 1: The Shader
During the shading of the Cream, we came into a fork in the road. Do we shade it as a tried and true mesh, or do we shade as a volume? They both have give and takes, the meshing can be janky sometimes with FLIP fluids but they give us easier shading tweaks, as well as crisp edges. On the other hand, the flow of the Cream would feel so much more floaty and dynamic, but shading has less control and density would be a real issue. The other benefit of volumectric rendering is that layering cream in coffee gives it a much better layering and softness that you simply cant get with something like subsurface and transmission in standard shaders. Our solution? A little bit of both!(but not really) The cream is done with volumes, but by converting the cream to a mesh, we can easily find contact points between the cream and the wall of the coffee mesh. With a simple material blend, we can switch between the coffee shader and a "Contact" cream shader. And since it's much easier to edit surface shaders, we can dial in the shader perfectly!
Challenge 2: The Shaping
Secondly, the other challenge was in the simulation itself. There are 2 types of coffee pours, one where the cream streams down and one where the coffee billows until evenly distributed. The obvious answer would be to simulate everything together in one go.
Wouldn't be a bad idea except:
Its a close up shot, a lot of empty space
With the amount of detail required for a close up, there'd be almost no compression with all the points so my file size would be in the gigabytes per frame. No thank you.
What we decided instead was to do it all in a pyro simulation. A traditional smoke sim that we can mesh if need be, but the movement will all be calculated inside the pyro solver. The techniques used in the solver are generic except for two things.
The first being we made a scalar field that acts as a "dense bucket," with a drag force to slow the downward velocity. In case you're unfamiliar, a quick change in velocity is what causes the mushroomy, billowy feeling of an explosion. We can use that to our advantage. The second technique is directly adding divergence into our simulation. The dense bucket making the mushrooms isn't enough to give us curling, but not expansion. Expansion is pretty much directly associated with a field in our simulation called "Divergence." In most cases, divergence is calculated for us, but I could not satiate my hunger for more. So I did something crazy (for the most part). I made a wrangle and inside wrote @divergence = @density. This means if there's density in the smoke anywhere, it WILL be expanding. A little warning, don't do this. It only worked because it was meant to be over the top.
And with that, everything was relatively simple! There were for sure more issues an challenges but we can go over those in later studies! Stay tuned! Next one will be our photogrammetry techniques!
コメント