How to bake multiple materials (from the same mesh) into one image texture in cycles?

I know how to bake an object that has 1 material in cycles, but when the object has multiple materials, I get a “no active image found in material x for object y” error message.

I understand the other materials don’t have a texture image hooked onto it, which is why I get the error…but how can I accomplish baking multiple materials (applied to different parts of one mesh) into one image? Hope this made sense!

Try adding the same texture node to each material

Yup, just that, make sure in every material it is highlighted as well, otherwise it still will not bake.

Amazing guys, that worked perfectly. Thank you very much!

Should this still work in Blender 2.93? I’m trying this but it’s not working for me, it still only bakes the first slot (my mesh uses two materials in two different slots and I’m trying to bake both to a single image)

Haven’t tried it in 2.93 but I don’t see why not. Are you getting the “no active image” error in 2.93? have you added the relevant texture node and highlighted it in both?

EDIT: Just tried it, works fine. Replace my images with yours and then bake, this scene worked for me in 2.93
(TESTIMG is the image to bake to)
Monday_20-September-2021_16.48_01.blend (1.0 MB)