Regression: Gradient colors in a Grease Pencil material change depending on the visibility of other objects #98882

Closed
opened 2022-06-14 12:57:21 +02:00 by ALEKSANDR_Romanets · 15 comments

System Information
Operating system: Windows-10-10.0.19044-SP0 64 Bits
Graphics card: GeForce GTX TITAN/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 456.71

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

Short description of error
If I import a Grease pencil object that has a gradient radial fill into the scene, that fill won’t work. But if I turn off the visibility of another Grease pencil object, the visibility of the fill starts working. This behavior is the same for other imported Grease pencil objects. If there are several Grease pencil objects with a radial gradient in the scene, only one will work, the others must be disabled.
I asked other users to test this problem. They confirmed the problem.
Thank you! gradient_problem.mp4

Exact steps for others to reproduce the error

  • Open attached .blend file
  • Unhide the "Stroke" Object

problem_gradient.blend I am waiting for your help.

**System Information** Operating system: Windows-10-10.0.19044-SP0 64 Bits Graphics card: GeForce GTX TITAN/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 456.71 **Blender Version** Broken: version: 3.2.0, branch: master, commit date: 2022-06-08 10:22, hash: `e05e1e3691` Worked: version: 3.1.2 **Short description of error** If I import a Grease pencil object that has a gradient radial fill into the scene, that fill won’t work. But if I turn off the visibility of another Grease pencil object, the visibility of the fill starts working. This behavior is the same for other imported Grease pencil objects. If there are several Grease pencil objects with a radial gradient in the scene, only one will work, the others must be disabled. I asked other users to test this problem. They confirmed the problem. Thank you! [gradient_problem.mp4](https://archive.blender.org/developer/F13161970/gradient_problem.mp4) **Exact steps for others to reproduce the error** - Open attached .blend file - Unhide the "Stroke" Object [problem_gradient.blend](https://archive.blender.org/developer/F13161975/problem_gradient.blend) I am waiting for your help.

Added subscriber: @Alex_Rom

Added subscriber: @Alex_Rom
Germano Cavalcante changed title from Problem gradient radial to Regression: Gradient colors in a Grease Pencil material change depending on the visibility of other objects 2022-06-17 15:36:18 +02:00

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

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

Added subscriber: @mano-wii

Added subscriber: @mano-wii

Thanks for the report, I can confirm.
I'll look for the commit that introduced the problem.

Thanks for the report, I can confirm. I'll look for the commit that introduced the problem.

Added subscriber: @antoniov

Added subscriber: @antoniov

@mano-wii I don't know the draw code for this area and I cannot fix this bug. Could you handle it?

@mano-wii I don't know the draw code for this area and I cannot fix this bug. Could you handle it?

Added subscriber: @fclem

Added subscriber: @fclem

Doing some tests with RenderDoc I noticed that the value of matid is wrong in:
{https://developer.blender.org/diffusion/B/browse/master/source/blender/draw/engines/gpencil/shaders/gpencil_frag.glsl$71}

Moving back a bit the wrong value appears to be added in:
{https://developer.blender.org/diffusion/B/browse/master/source/blender/draw/engines/gpencil/shaders/gpencil_vert.glsl$128}

Comparing with the way to access a material in {https://developer.blender.org/diffusion/B/browse/master/source/blender/draw/engines/gpencil/shaders/gpencil_vert.glsl$34}, I tried the solution below and it seems to solve the problem:

diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_vert.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_vert.glsl
index af8aec85598..5f5419bac47 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_vert.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_vert.glsl
@@ -125,7 +125,7 @@ void main()
     gpencil_color_output(fill_col, fcol_decode, 1.0, gp_mat._fill_texture_mix);
 
     gp_interp.mat_flag = gp_flag & GP_FILL_FLAGS;
-    gp_interp.mat_flag |= uint(ma1.x) << GPENCIl_MATID_SHIFT;
+    gp_interp.mat_flag |= uint(ma1.x + gpMaterialOffset) << GPENCIl_MATID_SHIFT;
 
     gp_interp.uv = mat2(gp_mat.fill_uv_rot_scale.xy, gp_mat.fill_uv_rot_scale.zw) * uv1.xy +
                    gp_mat._fill_uv_offset;

If I have to guess, I'd say the problem was introduced in eccb0b222e.
I'm not sure if that is the ideal solution, @fclem any thoughts?

Doing some tests with `RenderDoc` I noticed that the value of `matid` is wrong in: {https://developer.blender.org/diffusion/B/browse/master/source/blender/draw/engines/gpencil/shaders/gpencil_frag.glsl$71} Moving back a bit the wrong value appears to be added in: {https://developer.blender.org/diffusion/B/browse/master/source/blender/draw/engines/gpencil/shaders/gpencil_vert.glsl$128} Comparing with the way to access a material in {https://developer.blender.org/diffusion/B/browse/master/source/blender/draw/engines/gpencil/shaders/gpencil_vert.glsl$34}, I tried the solution below and it seems to solve the problem: ``` diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_vert.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_vert.glsl index af8aec85598..5f5419bac47 100644 --- a/source/blender/draw/engines/gpencil/shaders/gpencil_vert.glsl +++ b/source/blender/draw/engines/gpencil/shaders/gpencil_vert.glsl @@ -125,7 +125,7 @@ void main() gpencil_color_output(fill_col, fcol_decode, 1.0, gp_mat._fill_texture_mix); gp_interp.mat_flag = gp_flag & GP_FILL_FLAGS; - gp_interp.mat_flag |= uint(ma1.x) << GPENCIl_MATID_SHIFT; + gp_interp.mat_flag |= uint(ma1.x + gpMaterialOffset) << GPENCIl_MATID_SHIFT; gp_interp.uv = mat2(gp_mat.fill_uv_rot_scale.xy, gp_mat.fill_uv_rot_scale.zw) * uv1.xy + gp_mat._fill_uv_offset; ``` If I have to guess, I'd say the problem was introduced in eccb0b222e. I'm not sure if that is the ideal solution, @fclem any thoughts?

@mano-wii It is the right fix. You can commit it.

@mano-wii It is the right fix. You can commit it.

This issue was referenced by 9410d7bd2e

This issue was referenced by 9410d7bd2e9d8c5fc45341624ee5968490bca388

This issue was referenced by 270ed1c716

This issue was referenced by 270ed1c7164c2da47b27e4403bf44554a80ed71c

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Germano Cavalcante self-assigned this 2022-06-28 18:14:10 +02:00
Member

Added subscriber: @PratikPB2123

Added subscriber: @PratikPB2123
Member

@mano-wii , what do you think about backporting your commit to 3.2?

@mano-wii , what do you think about backporting your commit to 3.2?

In fact I forgot this important detail.
Thanks for reminding me
Done: #98661 (3.2: Potential candidates for corrective releases)

In fact I forgot this important detail. Thanks for reminding me Done: #98661 (3.2: Potential candidates for corrective releases)
Thomas Dinges added this to the 3.2 milestone 2023-02-08 15:51:07 +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
6 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#98882
No description provided.