Cycles Baking Denoise Margins Issue

I’m super excited about being able to denoise Cycles bakes with 3.0. However, I am having an issue that when I bake with a margin, the margin pixels produce an ugly seam. Here is a closeup of part of a UV patch that has been baked with denoise:

You can see that the margin pixels are darker and much ‘noisier’ than the island area, and when drawn in game the seams are quite ugly. I can sidestep the issue by baking with no margin and using an external tool to pad the UV islands separately, but is there any way to get Blender to correctly bake the margins? Even if I could at least get the margins to match in brightness with the edges of the island that would be a big help.

I did find https://developer.blender.org/T92943 and https://devtalk.blender.org/t/texture-border-margin-generation-by-copying-pixels-from-the-adjacent-polygon/21461 which seem to touch on this, so I’m guessing there isn’t really a solution for now, but maybe I’m wrong. In the first link someone says cycles bakes only the pixels which are inside the polygon on the UV map. The border is then generated by just repeating these colors outwards which doesn’t actually seem to be the case, since duplicating the border pixels outward would at least make the margin pixels match in brightness with the edge pixels.

Thanks for any help.

Edit: Apparently, it seems as if even baking without margins won’t work, because the problem seems to be with the edges of the denoised bake themselves. Even UV seams that lie on a flat surface end up with dark banding at the very edge, which is repeated and blurred into the margin.

Don’t think that is a thing yet.
https://developer.blender.org/D3099

Margin bake works on my end.
image

Yeah, I don’t think the problem is with the margins after all, it’s a problem with the denoising. If I bake without denoise, the seams turn out just fine, but as soon as I enable denoise, then I get dark banding along the island edges. eg:

image

On the left is a noisy bake, on the right is the same bake with denoise. The left island fits well in-game with the other half of the part, with no visible seam, but the denoised version has dark banding at the seams that is quite visible, and it is those darkened pixels that get expanded out to make the margin.

The link you provided gives the reason for this, I think: Since the filtering happens in pixel (and therefore UV) space, seams in the UV mapping show up in the final result because pixels in a different UV island will be outside the denoising radius and therefore missed. So maybe they’ll provide a fix for it in 3.1 or something. Until then, I’m not sure baking denoise is quite usable yet, unless the seams are well hidden.

1 Like

Are you baking lighting with the textures?

Yes. The objects are solid colored, so I am essentially baking colored lightmaps.