Highlight selected face option causes overall fade overlay #73912

Closed
opened 2020-02-17 09:09:45 +01:00 by Pasang Bomjan · 17 comments

System Information
Operating system: Windows-10-10.0.18362-SP0 64 Bits
Graphics card: Intel(R) HD Graphics 400 Intel 4.4.0 - Build 20.19.15.5070

Blender Version
Broken: version: 2.83 (sub 3), branch: master, commit date: 2020-02-14 23:40, hash: 92a56bbe6a
Worked: (optional)

Short description of error
In edit mode when the Highlight Selected Facesoption is ON, there's overall faded overlay in the mesh. Happens in all render engine, solid or viewport rendered mode and even in 2.82.Exact steps for others to reproduce the error
Here's a test file so you don't have to make it.
Just turn on/off the option.

Test file.blend

Highlight Selected Faces ON
On.png
Highlight Selected Faces OFF
Off.png

**System Information** Operating system: Windows-10-10.0.18362-SP0 64 Bits Graphics card: Intel(R) HD Graphics 400 Intel 4.4.0 - Build 20.19.15.5070 **Blender Version** Broken: version: 2.83 (sub 3), branch: master, commit date: 2020-02-14 23:40, hash: `92a56bbe6a` Worked: (optional) **Short description of error** In edit mode when the ***Highlight Selected Faces***option is ON, there's overall faded overlay in the mesh. Happens in all render engine, solid or viewport rendered mode and even in 2.82.**Exact steps for others to reproduce the error** Here's a test file so you don't have to make it. Just turn on/off the option. [Test file.blend](https://archive.blender.org/developer/F8344531/Test_file.blend) Highlight Selected Faces **ON** ![On.png](https://archive.blender.org/developer/F8344536/On.png) Highlight Selected Faces **OFF** ![Off.png](https://archive.blender.org/developer/F8344535/Off.png)
Author

Added subscriber: @Pasang

Added subscriber: @Pasang

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

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

Added subscriber: @ideasman42

Added subscriber: @ideasman42

Could you explain why this is a problem?

Could you explain why this is a problem?

Changed status from 'Confirmed' to: 'Needs User Info'

Changed status from 'Confirmed' to: 'Needs User Info'
Author

That option is only supposed to toggle the highlight of the selected faces. But it fades the entire geometry when the option is on. It shouldn't happen at all. This is why I reported it as a bug.
It happens in 2.82 release as well but it's subtle.

That option is only supposed to toggle the highlight of the selected faces. But it fades the entire geometry when the option is on. It shouldn't happen at all. This is why I reported it as a bug. It happens in 2.82 release as well but it's subtle.

Changed status from 'Needs User Info' to: 'Confirmed'

Changed status from 'Needs User Info' to: 'Confirmed'

Confirmed the opacity of the overlay increased in 2.83 (master).

From your report:

Happens in all render engine, solid or viewport rendered mode and even in 2.82.

As you saying this should not be any overlay? or that it should match 2.82?

Confirmed the opacity of the overlay increased in 2.83 (master). From your report: > Happens in all render engine, solid or viewport rendered mode and even in 2.82. As you saying this should not be any overlay? or that it should match 2.82?

The change in master is caused by 804e90b42d.

The blending function in source/blender/gpu/shaders/gpu_shader_image_overlays_merge_frag.glsl isn't handling alpha properly.

This resolves the overlay issue but causes a black background.

diff --git a/source/blender/gpu/shaders/gpu_shader_image_overlays_merge_frag.glsl b/source/blender/gpu/shaders/gpu_shader_image_overlays_merge_frag.glsl
index e8323520af5..dc6e68415bd 100644
--- a/source/blender/gpu/shaders/gpu_shader_image_overlays_merge_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_image_overlays_merge_frag.glsl
@@ -33,8 +33,8 @@ void main()
 
   vec4 overlay_col = texture(overlays_texture, texCoord_interp.st);
 
-  fragColor *= 1.0 - overlay_col.a;
-  fragColor += overlay_col;
+  fragColor.xyz = (fragColor.xyz * (1.0 - overlay_col.a)) + (overlay_col.xyz * overlay_col.a);
+  fragColor.a = min(fragColor.a + overlay_col.a, 1.0);
 
   if (display_transform) {
     linearrgb_to_srgb(fragColor, fragColor);
The change in master is caused by 804e90b42d. The blending function in `source/blender/gpu/shaders/gpu_shader_image_overlays_merge_frag.glsl` isn't handling alpha properly. This resolves the overlay issue but causes a black background. ``` diff --git a/source/blender/gpu/shaders/gpu_shader_image_overlays_merge_frag.glsl b/source/blender/gpu/shaders/gpu_shader_image_overlays_merge_frag.glsl index e8323520af5..dc6e68415bd 100644 --- a/source/blender/gpu/shaders/gpu_shader_image_overlays_merge_frag.glsl +++ b/source/blender/gpu/shaders/gpu_shader_image_overlays_merge_frag.glsl @@ -33,8 +33,8 @@ void main() vec4 overlay_col = texture(overlays_texture, texCoord_interp.st); - fragColor *= 1.0 - overlay_col.a; - fragColor += overlay_col; + fragColor.xyz = (fragColor.xyz * (1.0 - overlay_col.a)) + (overlay_col.xyz * overlay_col.a); + fragColor.a = min(fragColor.a + overlay_col.a, 1.0); if (display_transform) { linearrgb_to_srgb(fragColor, fragColor); ```
Clément Foucault was assigned by Campbell Barton 2020-02-21 04:21:33 +01:00

@ideasman42 The blending IS done properly. This was done on purpose. The issue is that now we are doing blending in linear space for correctness which change pretty much all UI colors which use alpha blending. So we should patch the theme instead of the blending function.

@ideasman42 The blending IS done properly. This was done on purpose. The issue is that now we are doing blending in linear space for correctness which change pretty much all UI colors which use alpha blending. So we should patch the theme instead of the blending function.

@fclem are you sure about this? Using linear color didn't impact alpha handling in other areas of Blender IIRC.

Blending color in linear space shouldn't have to change alpha strength.

A white overlay on a black surface seems much lighter than it should be.

  • The default theme alpha of 7.06% alpha results in 29.41% white.
  • Increase the alpha to 18.43% for 50.00% white.

Toggle edit-mode on this file.
black_overlay.blend

@fclem are you sure about this? Using linear color didn't impact alpha handling in other areas of Blender IIRC. Blending color in linear space shouldn't have to change alpha strength. A white overlay on a black surface seems much lighter than it should be. * The default theme alpha of 7.06% alpha results in 29.41% white. * Increase the alpha to 18.43% for 50.00% white. Toggle edit-mode on this file. [black_overlay.blend](https://archive.blender.org/developer/F8356610/black_overlay.blend)

Alpha handling is totally dependent on colorspace. In your example 0.07(linear) ^ (1.0/2.2) is almost 0.3(srgb). Because everything is now rendering in linear space all blending is also done in this space. Which is why brighter colors are more blended by alpha blending than before (visually speaking but linear values are correct).

A 50% white in linear (radiometrically speaking) is not perceived as Half grey by human eye.

This is also why I did a trick to blend background colors to have perceptually pleasing gradient (i interpolated in non linear space).

But here we cannot have a one liner patch because the blending is done in linear space by opengl and compositing is done much further than where this happens.
We cannot autopatch theme because it depends on the perceived color.

Reminder that this move to linear colors is to make things move in the direction of HDR support / better AA / better colormanagement in general.

Alpha handling is totally dependent on colorspace. In your example 0.07(linear) ^ (1.0/2.2) is almost 0.3(srgb). Because everything is now rendering in linear space all blending is also done in this space. Which is why brighter colors are more blended by alpha blending than before (visually speaking but linear values are correct). A 50% white in linear (radiometrically speaking) is not perceived as Half grey by human eye. This is also why I did a trick to blend background colors to have perceptually pleasing gradient (i interpolated in non linear space). But here we cannot have a one liner patch because the blending is done in linear space by opengl and compositing is done much further than where this happens. We cannot autopatch theme because it depends on the perceived color. Reminder that this move to linear colors is to make things move in the direction of HDR support / better AA / better colormanagement in general.

This issue was referenced by a31bd3f7b5

This issue was referenced by a31bd3f7b5cf27166ccdf3b33890533c5366eb4f

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'

Even with the difference between perceptual-brightness/RGB-value the change in brightness seemed very strong.

Although changing the face overlay color to black doesn't have the same impact.

Committed tweak to the theme to reduce the intensity for bright colors.

Even with the difference between perceptual-brightness/RGB-value the change in brightness seemed very strong. Although changing the face overlay color to black doesn't have the same impact. Committed tweak to the theme to reduce the intensity for bright colors.

Added subscriber: @1D_Inc

Added subscriber: @1D_Inc

Speaking of face overlays, it was turned to white.
White overlay makes vertices/edges selection dim due to lower contrast with brighter faces, so we changing it to black in theme settings.
We also constantly keeping highlight edges checkbox in mesh edit mode overlays turned on to percept selection properly.

Speaking of face overlays, it was turned to white. White overlay makes vertices/edges selection dim due to lower contrast with brighter faces, so we changing it to black in theme settings. We also constantly keeping highlight edges checkbox in mesh edit mode overlays turned on to percept selection properly.
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
5 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#73912
No description provided.