6
$\begingroup$

I want to make a cup of coffee with the nice swirl of white and brown foam, but I want to be able to influence it using an object (similar to how they make hearts in cappuccino). In this case it's an .svg logo I would import. I've seen lots of examples where image textures were used for foam, but I'm wondering if there's a way to actually influence the foam in Blender itself. Is this possible?

Here's an example of the type of foam I am going for:

enter image description here

And here is an example of a logo I would want to use as the design in the foam:

enter image description here

EDIT:

Here are the changes I made based on responses provided. I modified the node setup slightly in that I did not use the coffee nodes as I decided to just use an image texture for that. Unfortunately, it made the logo part heavily distorted and I'm not sure why.

Here's the node setup:

enter image description here

Here's the result:

enter image description here

I've attached the .blend:

NEW EDIT:

Based on the follow up answers provided, here is the finished render (including blur techniques used in GIMP):

enter image description here

$\endgroup$
9
  • 2
    $\begingroup$ Use the image as a mask to separate two shaders and as a bump map. $\endgroup$
    – Timaroberts
    Jan 18 '18 at 20:34
  • $\begingroup$ Convert the svg to a bitmap image. Use the image to mix two textures. $\endgroup$
    – user1853
    Jan 18 '18 at 20:42
  • $\begingroup$ This may be of some help youtube.com/watch?v=4rNrL7a12xg&t=2694s $\endgroup$
    – icYou520
    Jan 18 '18 at 21:09
  • $\begingroup$ @Timaroberts do you mean using a mix shader with both images? $\endgroup$
    – lakerice
    Jan 18 '18 at 21:41
  • $\begingroup$ @cegaton same question I asked Tim $\endgroup$
    – lakerice
    Jan 18 '18 at 21:42
5
$\begingroup$

It's not extremely good, but this should give you a good place to start:
Render 1
Render 2

The image you want to appear on the foam is very detailed and hard to reproduce on real coffee. This is why I thought it should be pre-processed in some image editing software to make it more realistic and doable. I used Photoshop to smudge out the image a bit, and I got this:
Texture

The coffee itself that I made in Blender was a simple squeezed sphere. I then used the image above as a texture to determine the color of the foam. Here is my node setup for the foam:
Setup
I'll go into the details now.

Distorting the image

I used a Wave texture to distort the image in rings. You can adjust the frequency and amplitude of the distortions.
Distortion

Some noise texture on top of that

I added some noise to the image, because nocoffee is perfect.
Noise

Bump map

I didn't have any actual coffee to look at, but I'm assuming that the image should have some effect on the bumps in the foam, due to stirring. So I created some "ripple" bumps around the borders of the texture (kinda):
Bump map

The coffee shader

Now, we have calculated both the texture we want on the coffee and the bump map. I used a gradient to get the right coffee colors. The actual shader was a simple mix of a diffuse shader and a glossy shader:
Shader

Here is my resulting .blend file you can play with:

Here are some possible improvements you could consider:
- It is very easy to adjust how much you want the image to be distorted in rings. In the "Distort Image" frame, just change the second value of the Divide math node. - Consider introducing a subsurface scattering component, because coffee is transparent. Or, even better, use a volume shader. Coffee is a little bit transparent. - You could change the colors to make them a little warmer, because my coffee looks like mud. Yuck. :) - You could further tweak the original image: smudge it, adjust contrast, add noise, etc.

$\endgroup$
5
  • $\begingroup$ thanks for this incredibly detailed answer and effort! Unfortunately I was not able to reproduce the result (I tried to create the nodes from scratch so I could better understand). I've posted the .blend and my setup in my revised question. Let me know what you think... $\endgroup$
    – lakerice
    Jan 19 '18 at 17:06
  • 1
    $\begingroup$ @lakerice I think you're on the right track! I looked at your node setup, and noticed two mistakes: you used a color mix node instead of the mix shader, and the math node where you need a vector math node. Here is a .blend file where I fixed these mistakes, so the texture works now. But you still need to work with the colors. Good luck! :) $\endgroup$ Jan 19 '18 at 17:39
  • $\begingroup$ Oh that makes sense! It's easy to mix up (no pun intended) those nodes. One more question: is it possible to make the logo bubbly like the coffee texture? Or make it take on the bump of the coffee texture? $\endgroup$
    – lakerice
    Jan 19 '18 at 18:49
  • $\begingroup$ @lakerice, I'm not sure what you mean by a "bubbly" logo, but you can definitely add a bump map with bubbles. I would try to use the Voronoi texture with a scale of ~150, and plug that into the Bump node (you can input a normal in the bump node to combine two bump textures). Then send the output to the material's normal. (You could also mask it so that it only affects the logo, but that's too long to explain in a comment.) $\endgroup$ Jan 19 '18 at 22:06
  • 1
    $\begingroup$ sorry for the late response. I tried using the voronoi but I wasn't able to achieve a realistic result (at least the way I tried) but I ended up using the bump for the coffee image for the logo as well so they basically followed the same texture. Also, I used blur techniques in GIMP to get a more blended result (I'm sure there's a way in Blender but for convenience sake I just manipulated the logo .png itself). You can see my finished result in my question if you like :) Thanks again for your help! $\endgroup$
    – lakerice
    Jan 22 '18 at 18:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.