Regression: black seams in my Cycles bakes (caused by denoising) due to margin pixel extension darkening #94573

Open
opened 2022-01-02 13:44:08 +01:00 by L. N. · 18 comments

System Information
Operating system: Windows-10-10.0.19042-SP0 64 Bits
Graphics card: GeForce RTX 2080 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 461.92

Blender Version
Broken: version: 3.0.0, branch: master, commit date: 2021-12-02 18:35, hash: f1cca30557
Worked: 2.93.7

Short description of error
I get black seams when I bake textures that I never used to have before upgrading to 3.0. They occur on any corner that I UV as shown here:
cycles_bake_dark_seam.png

Exact steps for others to reproduce the error
Black Seams.rar
UV a mesh with only 1 split on the corners leaving the other sides still attached. Bake a combined texture to 2048x2048 resolution with Cycles. Apply to mesh. Observe the black seams on the corners.
Now open that same file and bake that same mesh in 2.93.7. No black seams. Re-save file in 2.93, and re-open that file in Blender 3.0, and it now bakes without a black seam too.

**System Information** Operating system: Windows-10-10.0.19042-SP0 64 Bits Graphics card: GeForce RTX 2080 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 461.92 **Blender Version** Broken: version: 3.0.0, branch: master, commit date: 2021-12-02 18:35, hash: `f1cca30557` Worked: 2.93.7 **Short description of error** I get black seams when I bake textures that I never used to have before upgrading to 3.0. They occur on any corner that I UV as shown here: ![cycles_bake_dark_seam.png](attachments/a6c6b83c-17e1-4605-9d5d-dc46977c44c9) **Exact steps for others to reproduce the error** [Black Seams.rar](https://archive.blender.org/developer/F12785204/Black_Seams.rar) UV a mesh with only 1 split on the corners leaving the other sides still attached. Bake a combined texture to 2048x2048 resolution with Cycles. Apply to mesh. Observe the black seams on the corners. Now open that same file and bake that same mesh in 2.93.7. No black seams. Re-save file in 2.93, and re-open that file in Blender 3.0, and it now bakes without a black seam too.
Author

Added subscriber: @aintnobody

Added subscriber: @aintnobody

#97808 was marked as duplicate of this issue

#97808 was marked as duplicate of this issue
Member

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Member

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'
Member

Can confirm the regressed baked pixel extension on borders.
I think this has been reported before (but cannot find the duplicate atm.)

Can confirm the regressed baked pixel extension on borders. I think this has been reported before (but cannot find the duplicate atm.)
Member

It is caused by denoising btw (without it, pixel extension seems to behave better)

It is caused by denoising btw (without it, pixel extension seems to behave better)
Philipp Oeser changed title from Black seams in my Cycles bakes since I upgraded to 3.0 to Regression: black seams in my Cycles bakes (caused by denoising) due to margin pixel extension darkening 2022-01-03 10:56:33 +01:00

Added subscriber: @brecht

Added subscriber: @brecht

The denoiser is softening the sharp edges, assuming it's noise. Not clear how best to solve this, probably need to extend the baked pass as well with denoising albedo/normal passes in Cycles.

The denoiser is softening the sharp edges, assuming it's noise. Not clear how best to solve this, probably need to extend the baked pass as well with denoising albedo/normal passes in Cycles.
Author

I hadn't even noticed until Philipp mentioned it that denoising had become available with baking, which is amazing! But yeah, the black seams need to be fixed please, otherwise it's useless. I have to bake with denoising disabled for now. I will be so happy when I can bake denoised textures.

I hadn't even noticed until Philipp mentioned it that denoising had become available with baking, which is amazing! But yeah, the black seams need to be fixed please, otherwise it's useless. I have to bake with denoising disabled for now. I will be so happy when I can bake denoised textures.

For reference, relevant OpenImageDenoise discussion:
https://github.com/OpenImageDenoise/oidn/issues/112

For reference, relevant OpenImageDenoise discussion: https://github.com/OpenImageDenoise/oidn/issues/112
Author

This wasn't fixed in 3.0 - will it ever be addressed ?

This wasn't fixed in 3.0 - will it ever be addressed ?
Member

Added subscribers: @yPodo, @PratikPB2123

Added subscribers: @yPodo, @PratikPB2123

Added subscriber: @EvandroFerreiradaCosta

Added subscriber: @EvandroFerreiradaCosta

In #94573#1292126, @brecht wrote:
Not clear how best to solve this.

I'd assume one simple solution would be to Denoise the bake before extending the margin, this way the margin will be generated from the denoised version, instead of the noisy image that was stretched to generate a margin.

It appears to me that the denoise algorithm doesn't know how to denoise a black streak instead of a black dot (the optix/OID AI was trained only on dot-pattern noise?)... so the solution is to denoise before stretching.

The caveat is when we are baking multiple objects to the same map, which in the current state, the denoise pass happens only after the entirety of it is baked?
It would have to be changed to happen after every bake is completed but before the margin is applied... only then it starts baking the next object.
Or Blender could store the entire noisy bake from multiple objects without generating a margin, and only applies the margin after the final denoise pass... which would also be beneficial because nowadays if you want to bake multiple objects to the same map, the margins are not SMART like in substance painter, a.k.a, later objects being baked start generating margin on top of previous margins/bakes. By generating the margin at the last step, and taking into consideration the other objects islands, blender would avoid generating margins that overlap others. And the problem with margins not being denoised would also be solved... two rabbits for one.

> In #94573#1292126, @brecht wrote: >Not clear how best to solve this. I'd assume one simple solution would be to Denoise the bake before extending the margin, this way the margin will be generated from the denoised version, instead of the noisy image that was stretched to generate a margin. It appears to me that the denoise algorithm doesn't know how to denoise a black streak instead of a black dot (the optix/OID AI was trained only on dot-pattern noise?)... so the solution is to denoise before stretching. The caveat is when we are baking multiple objects to the same map, which in the current state, the denoise pass happens only after the entirety of it is baked? It would have to be changed to happen after every bake is completed but before the margin is applied... only then it starts baking the next object. Or Blender could store the entire noisy bake from multiple objects without generating a margin, and only applies the margin after the final denoise pass... which would also be beneficial because nowadays if you want to bake multiple objects to the same map, the margins are not SMART like in substance painter, a.k.a, later objects being baked start generating margin on top of previous margins/bakes. By generating the margin at the last step, and taking into consideration the other objects islands, blender would avoid generating margins that overlap others. And the problem with margins not being denoised would also be solved... two rabbits for one.

It's the other way around, we are denoising before extending the margin, which gives discontinuities. Swapping that order may help, but is not trivial in the current code.

It's the other way around, we are denoising before extending the margin, which gives discontinuities. Swapping that order may help, but is not trivial in the current code.
Author

If that helps, I have never had these seam issues when I denoise a baked texture manually in the Compositing tab this way: https://i.gyazo.com/32d625c25caee2e38eb06e65f6377296.png

It only happens if I check the Denoise checkbox to have my bakes be automatically denoised. So whatever the first method does right, would it be possible to apply it to the automatic Denoising ?

If that helps, I have never had these seam issues when I denoise a baked texture manually in the Compositing tab this way: https://i.gyazo.com/32d625c25caee2e38eb06e65f6377296.png It only happens if I check the Denoise checkbox to have my bakes be automatically denoised. So whatever the first method does right, would it be possible to apply it to the automatic Denoising ?

@aintnobody Maybe it doesn't generate black seams there in the compositor because then it's denoising the image already with a margin present... so this workflow has the margin step happening before the denoise (working in reverse of what I previously though, as corrected by @Brecht... thanks!)
This seems to indicate that denoising after the margin step would indeed be a valid solution... but if it's non trivial as Brecht mentioned, then we are left waiting for newer versions of OIDN to fix this for us.
According to that github discussion linked earlier:
"The "bleeding" artifact is more like ringing, which has been significantly alleviated (but not completely fixed) in recent versions of OIDN."

So maybe someday it will be completely fixed, outside of blender.

@aintnobody Maybe it doesn't generate black seams there in the compositor because then it's denoising the image already with a margin present... so this workflow has the margin step happening before the denoise (working in reverse of what I previously though, as corrected by @Brecht... thanks!) This seems to indicate that denoising after the margin step would indeed be a valid solution... but if it's non trivial as Brecht mentioned, then we are left waiting for newer versions of OIDN to fix this for us. According to that github discussion linked earlier: *"The "bleeding" artifact is more like ringing, which has been significantly alleviated (but not completely fixed) in recent versions of OIDN."* So maybe someday it will be completely fixed, outside of blender.

Added subscriber: @JonathanLampel-4

Added subscriber: @JonathanLampel-4
Philipp Oeser removed the
Interest
Render & Cycles
label 2023-02-09 14:03:24 +01:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
6 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#94573
No description provided.