Texture baking to 'Selected' instead of 'Active' image

Hi, I wanted to get some feedback on something that’s been bothering me for ages.

I find myself quite often in the situation where I have an object with multiple materials. Some of them PBR materials and other procedural. When preparing the object for export I need to bake the procedural materials, but not the PBR materials.

So I add an empty image texture node to my procedural material and select it and bake.

However, when baking blender picks the active image texture from each material (or if none is active it even just picks a random one) and not just the selected images. This results in one of the images in each PBR material getting overwritten (the one that happens to be clicked last or happens to come first in the nodetree).

To prevent this from happening I need to add a ‘dummy’ active ImageTexture node in each PBR material to catch the stray baking. Which is far from ideal when working with linked materials.

This has caused textures from my material library to be overwritten when I was distracted on closing and just pressed ‘save all images’, which is a pain.

I created a simple patch locally which just skips all unselected image nodes, so it only bakes to the images explicitly selected.

This seems to me much better than the current behaviour. I could create a PR from it but I first wanted to ask if I’m overlooking something. Is there a situation where you actually want to bake to all ‘active’ images?

I know baking needs a revamp and it’s probably better to really fix the way it works, but this simple (2 ifs added and an error message adapted) patch does prevent a lot of frustration/data loss.

4 Likes

IMO this should be the default behaviour, the active image texture is not something easy to see/understand anywhere in the UI (unless you know how it works after messing up stuff by mistake). So baking should ALWAYS use only the selected image/s in the node tree, nothing else.

2 Likes

That’s what I’m thinking. But it seems so obvious that I can’t really believe that the way it currently works isn’t on purpose. There’s probably some workflow which depends on using the active image?

It seems ok, though it would be an API breaking change for baking add-ons. So it might be postponed to 5.0.

1 Like

I’ll go ahead and create a PR, then we can let it sit till a 5.0 branch is opened

2 Likes
1 Like