MatCap inverts if Viewport Display Metallic and Roughness are set below certain threshold #75938
Labels
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
4 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#75938
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
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?
System Information
Operating system: Windows-10-10.0.18362-SP0 64 Bits
Graphics card: GeForce RTX 2080 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 445.87
Blender Version
Broken: version: 2.83 (sub 13), branch: master, commit date: 2020-04-20 02:11, hash:
23bb42a06e
Worked: 2.82a
Short description of error
MatCap inverts if Viewport Display Metallic and Roughness are set below certain threshold.
Exact steps for others to reproduce the error
Change Viewport Shading to MatCap, select Cube, go to Material Properties to Viewport Display, set Metallic and Roughness to 0. Metallic can be as low as 0.144.
Added subscriber: @MarcZbinden
Changed status from 'Needs Triage' to: 'Confirmed'
Added subscriber: @fclem
The issue is the following part of the workbench_composite_frag.glsl
It changes the normal direction based on the data stored in the alpha channel. This appears to be incorrect for two reasons:
materialData.a = float(gl_FrontFacing);
is only set ifuseMatcap
is true. Despite its name, the variable is not always set to true when matcaps are used. It is only set to true forhaircertain shading groups inworkbench_opaque_cache_init
([ https:*developer.blender.org/diffusion/B/browse/master/source/blender/draw/engines/workbench/workbench_opaque.c | workbench_opaque.c ). As a result the alpha channel instead contains thepacked_rough_metal
, which is why the values for roughness and metal impact the direction of the normal.workbench_normal_encode(gl_FrontFacing, normal_interp)
already includes backface/frontface information (see https:*developer.blender.org/diffusion/B/browse/master/source/blender/draw/engines/workbench/shaders/workbench_common_lib.glsl ). If I'm not mistaken that makes the (potential) normal inversion in the [ https://developer.blender.org/diffusion/B/browse/master/source/blender/draw/engines/workbench/shaders/workbench_composite_frag.glsl | workbench_composite_frag.glsl redundant.If the
N = (mat_data.a > 0.0) ? N : -N;
is indeed redundant, then it could simply be removed along with thematerialData.a = float(gl_FrontFacing);
. If it isn't redundant, thenif (useMatcap)
should be replaced with a check that is always true when matcaps are used. This means either a different check/macro oruseMatcap
needs to be set to true for more cases than justhairthe current shading groups.@fclem Could you take a quick look and tell me which approach you would prefer?
We used the double inversion because users asked for it. It is indeed a strange thing but it's by design.
I think it's just a matter of adding
DRW_shgroup_uniform_bool_copy(grp, "useMatcap", use_matcap);
somewhere.@fclem Good to know. I will set
useMatcap
in the patch then.This issue was referenced by
0dfe30502a
Changed status from 'Confirmed' to: 'Resolved'