Nodes: Exclusion (Mix Color) clamps negative values even when Clamp Result is disabled #114242

Closed
opened 2023-10-29 08:38:19 +01:00 by quackarooni · 4 comments

System Information
Operating system: Windows 10 Home
Graphics card: Intel(R) UHD Graphics 605

Blender Version
Broken: since 3.5 when Exclusion was first implemented, (still persists in 4.0 and 4.1 daily builds)

Short description of error
When the blend type of the Mix Color node is set to Exclusion, its output clamps all negative values to 0.0 regardless of whether Clamp Result is toggled or not. This is true for Shader, Geometry, and Compositor versions of the node.

Most sources I could find only mention that Exclusion's formula is 'A + B - 2AB', and don't explicitly mention clamping for negative numbers. This behavior is also inconsistent with other blend types from the same group (i.e. Subtract, & Divide), which allow for negative values. Difference is an exception as it has an absolute value baked into its formula.

Exact steps for others to reproduce the error

  1. Combine two colors using Mix Color set to Exclusion. (Make sure any of the values lie outside of [0-1] so that the output value goes outside of range)
  2. Either a.) compare with a node implementation of the formula, or b.) compare for values that are exactly 0.0. In both cases, a discrepancy arises in regions where the value would've been negative if it wasn't clamped.

An example .blend file is also attached with examples of both.

**System Information** Operating system: Windows 10 Home Graphics card: Intel(R) UHD Graphics 605 **Blender Version** Broken: since 3.5 when Exclusion was first implemented, (still persists in 4.0 and 4.1 daily builds) **Short description of error** When the blend type of the `Mix Color` node is set to `Exclusion`, its output clamps all negative values to 0.0 regardless of whether `Clamp Result` is toggled or not. This is true for Shader, Geometry, and Compositor versions of the node. Most sources I could find only mention that Exclusion's formula is `'A + B - 2AB'`, and don't explicitly mention clamping for negative numbers. This behavior is also inconsistent with other blend types from the same group *(i.e. Subtract, & Divide)*, which allow for negative values. *Difference* is an exception as it has an absolute value baked into its formula. **Exact steps for others to reproduce the error** 1. Combine two colors using `Mix Color` set to `Exclusion`. *(Make sure any of the values lie outside of [0-1] so that the output value goes outside of range)* 2. Either a.) compare with a node implementation of the formula, or b.) compare for values that are exactly 0.0. In both cases, a discrepancy arises in regions where the value would've been negative if it wasn't clamped. An example .blend file is also attached with examples of both.
quackarooni added the
Priority
Normal
Status
Needs Triage
Type
Report
labels 2023-10-29 08:38:19 +01:00
Author

Example images attached below: (White areas represented negative values that were clamped at 0.0)

Shader Nodes
Exclusion Clamping - Shader Nodes.png
Geometry Nodes
Exclusion Clamping - Geometry Nodes.png
Compositor Nodes
Exclusion Clamping - Compositor Nodes.png
Example images attached below: *(White areas represented negative values that were clamped at 0.0)* | Shader Nodes | |--------| |![Exclusion Clamping - Shader Nodes.png](/attachments/ac2d68e4-b67a-4536-ab7b-5dd5a344c4c5)| | Geometry Nodes | |--------| |![Exclusion Clamping - Geometry Nodes.png](/attachments/26162e3e-72fa-4620-8809-31a277deafc7)| | Compositor Nodes | |--------| |![Exclusion Clamping - Compositor Nodes.png](/attachments/761190b4-f52e-48c4-a8ea-d249f9b3831f)|

I can confirm what was described. But I'm not sure what's really expected.

Exclusion mode was added in bea5fe6505 by @CharlieJolly

@CharlieJolly, could you provide some insight here?

I also noticed that the manual does not include this mode:
https://docs.blender.org/manual/en/4.1/render/shader_nodes/converter/mix.html?utm_source=blender-4.1.0-alpha#bpy-types-shadernodemix

Cc. @brecht, @OmarEmaraDev

I can confirm what was described. But I'm not sure what's really expected. Exclusion mode was added in bea5fe6505 by @CharlieJolly @CharlieJolly, could you provide some insight here? I also noticed that the manual does not include this mode: https://docs.blender.org/manual/en/4.1/render/shader_nodes/converter/mix.html?utm_source=blender-4.1.0-alpha#bpy-types-shadernodemix Cc. @brecht, @OmarEmaraDev
Germano Cavalcante added
Status
Needs Info from Developers
and removed
Status
Needs Triage
labels 2023-10-30 19:12:54 +01:00
Member

This is the intended behavior, but I guess it needs to be documented. This was discussed in details in the PR: https://archive.blender.org/developer/D16543.

This is the intended behavior, but I guess it needs to be documented. This was discussed in details in the PR: https://archive.blender.org/developer/D16543.

Thanks for the info!

For documentation, we have another repository. I think maybe it can be tracked down however at blender/blender-manual#104446 (Cc @Blendify)

Closing then.

Thanks for the info! For documentation, we have another repository. I think maybe it can be tracked down however at https://projects.blender.org/blender/blender-manual/issues/104446 (Cc @Blendify) Closing then.
Blender Bot added
Status
Archived
and removed
Status
Needs Info from Developers
labels 2023-10-30 19:46:11 +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
3 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#114242
No description provided.