# Is there a way to make custom coffee foam?

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:

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

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:

Here's the result:

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):

• Use the image as a mask to separate two shaders and as a bump map. – Timaroberts Jan 18 '18 at 20:34
• Convert the svg to a bitmap image. Use the image to mix two textures. – user1853 Jan 18 '18 at 20:42
• @Timaroberts do you mean using a mix shader with both images? – lakerice Jan 18 '18 at 21:41
• @cegaton same question I asked Tim – lakerice Jan 18 '18 at 21:42

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

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:

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:

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.

# Some noise texture on top of that

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

# 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):

Here is my resulting .blend file you can play with:
- 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.
• @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! :) – Reinis Mazeiks Jan 19 '18 at 17:39
• @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.) – Reinis Mazeiks Jan 19 '18 at 22:06