Fix #120175: File Output node has wrong BW output #120206
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
FBX
Interest
Freestyle
Interest
Geometry Nodes
Interest
glTF
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 & 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
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
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
Asset System
Module
Core
Module
Development Management
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#120206
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "OmarEmaraDev/blender:fix-120175"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The File Output node produces wrong output when the output is set to BW.
This is because the image saving logic assumes float buffers always have
4 channels and ignores the image buffer channels member. So for single
channel images, the code weighted sum neighbouring pixels and asigned
them as a single pixel, producing bleeding at best and crashes at worst.
To fix this, we skip Color to BW conversion if the image is already BW.
And, we fix the functions that assume 4 channels for float buffers.
This seems a bit strange, as the other usages of
IMB_color_to_bw
are not covered, and with this change you potentially leave byte buffer as color and not BW.I think doing something like this in the
IMB_color_to_bw
is fine:The PR should also be against the main branch. See https://developer.blender.org/docs/handbook/release_process/release_branch/#after-a-release
The only other
IMB_color_to_bw
usage is guaranteed to be a byte buffer, so it is not affected. As for the byte buffer, I just assumed float and byte buffers would be mutually exclusive as many parts of the code already do.I wanted to update
IMB_color_to_bw
andIMB_saturation
directly, but I thought it is best to leave that out of 4.1. But if you think this is best, I will update the patch. The other thing that we will be doing a redundant buffer duplication in most cases.f64d9008f1
to4489aa978c
Byte and float buffers are not mutually exclusive. Accessing data will choose the best suitable buffer, but pixel transforms are expected to keep both in sync. For example. in the
IMB_color_to_bw
you seeif (rct_fl) { ... } if (rct) { ... }
.Maybe with the way how some other areas work it is fine to have check on a higher level, but it somehow does not feel fully reliable.
The corrective release is scheduled for 16 April, so it seems to be OK amount of time to possibly catch unexpected issues with a change in
IMB_color_to_bw
. The change inIMB_saturation
we can limit to the main only.P.S. If we want to be extra careful, we can follow the
IMB_gpu_get_texture_format
and usechannels = image_buffer->channels == 0 ? 4 : image_buffer->channels
.@Sergey I added
!(ibuf->float_buffer.data && !ibuf->byte_buffer.data && ibuf->channels == 1)
to avoid redundant duplication, not sure if you would be pro adding it.I think it is fine to have that check, as it avoids unnecessary ImBug duplications if the
ImBuf
is a single-channel already.