Sculpt Paint: Mask by color produces an empty mask with a threshold of 0.0 #98838

Open
opened 2022-06-13 10:52:52 +02:00 by Floatharr · 4 comments

System Information
Operating system: Windows-10-10.0.19043-SP0 64 Bits
Graphics card: NVIDIA GeForce GTX 1080/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 512.95

Blender Version
Broken: version: 3.2.0, branch: master, commit date: 2022-06-08 10:22, hash: e05e1e3691

Short description of error
It is impossible to make a precise color selection from two similar colors with Mask by Color alone, because a threshold near or at 0 produces an empty mask. I consider this a bug because according to the comment in the source code, this functionality isn't working as intended. Quote directly from source code:

https://developer.blender.org/D8157

/* sculpt_mask_by_color_delta_get returns values in the (0,1) range that are used to generate the
 * mask based on the diference between two colors (the active color and the color of any other
 * vertex). Ideally, a threshold of 0 should mask only the colors that are equal to the active
 * color and threshold of 1 should mask all colors. In order to avoid artifacts and produce softer
 * falloffs in the mask, the MASK_BY_COLOR_SLOPE defines the size of the transition values between
 * masked and unmasked vertices. The smaller this value is, the sharper the generated mask is going
 * to be. */

For completeness, here is a real world scenario where it is tedious to mask the pants, shirt, or skin because the colors are too close together for the Mask by Color tool. image.png

Exact steps for others to reproduce the error

Apply two similar colors to a subdivided surface with the paint tool, and try to mask only one of them. The only way to produce a sharp mask is with the Increase Contrast operator when the Threshold is fine tuned to work with it.
blender_3Yh12TUXry.mp4

**System Information** Operating system: Windows-10-10.0.19043-SP0 64 Bits Graphics card: NVIDIA GeForce GTX 1080/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 512.95 **Blender Version** Broken: version: 3.2.0, branch: master, commit date: 2022-06-08 10:22, hash: `e05e1e3691` **Short description of error** It is impossible to make a precise color selection from two similar colors with Mask by Color alone, because a threshold near or at 0 produces an empty mask. I consider this a bug because according to the comment in the source code, this functionality isn't working as intended. Quote directly from source code: https://developer.blender.org/D8157 ``` /* sculpt_mask_by_color_delta_get returns values in the (0,1) range that are used to generate the * mask based on the diference between two colors (the active color and the color of any other * vertex). Ideally, a threshold of 0 should mask only the colors that are equal to the active * color and threshold of 1 should mask all colors. In order to avoid artifacts and produce softer * falloffs in the mask, the MASK_BY_COLOR_SLOPE defines the size of the transition values between * masked and unmasked vertices. The smaller this value is, the sharper the generated mask is going * to be. */ ``` For completeness, here is a real world scenario where it is tedious to mask the pants, shirt, or skin because the colors are too close together for the Mask by Color tool. ![image.png](https://archive.blender.org/developer/F13155082/image.png) **Exact steps for others to reproduce the error** Apply two similar colors to a subdivided surface with the paint tool, and try to mask only one of them. The only way to produce a sharp mask is with the Increase Contrast operator when the Threshold is fine tuned to work with it. [blender_3Yh12TUXry.mp4](https://archive.blender.org/developer/F13155118/blender_3Yh12TUXry.mp4)
Author

Added subscriber: @Floatharr

Added subscriber: @Floatharr
Member

Added subscriber: @OmarEmaraDev

Added subscriber: @OmarEmaraDev
Member

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

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

If the distance between the two colors is close to zero and the threshold is close to zero, then len = (-len + threshold) / MASK_BY_COLOR_SLOPE; will also be close to zero. Which I guess is not the expected behavior.

If the distance between the two colors is close to zero and the threshold is close to zero, then `len = (-len + threshold) / MASK_BY_COLOR_SLOPE;` will also be close to zero. Which I guess is not the expected behavior.
Philipp Oeser removed the
Interest
Sculpt, Paint & Texture
label 2023-02-10 09:11:18 +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
2 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#98838
No description provided.