Page MenuHome

Grease Pencil - Material - Fill - Style: broken Gradient and Texture
Closed, ResolvedPublicBUG

Description

System Information
Operating system: Darwin-19.3.0-x86_64-i386-64bit 64 Bits (Mac OS Catalina 10.15.3)
Graphics card: Intel Iris Pro OpenGL Engine Intel Inc. 4.1 INTEL-14.4.23

Blender Version
Broken: version: 2.83 (sub 11), branch: master, commit date: 2020-03-23 23:42, hash: rB94b8166a8b05, same for newer commit from 2020-03-24
Worked: 2.82a (2020-03-12)

Short description of error
When trying to set Gradient or Texture fill style type for GP material nothing happens - always have Solid look.

Exact steps for others to reproduce the error

  • from splash select New File - 2D Animation
  • draw shape (circle)
  • go to materials (Solid Stroke is selected by default)
  • check in Fill - change Style to Gradient
  • slide Mix Factor parameter to, for example, 0.5.

Same for Texture - still Base Color after assigning image and any change to Blend in Fill Texture paremeter.

or

  • Open attached file

As result, we will see Base Color without any gradient.

Event Timeline

Dmitry (Rezoob) updated the task description. (Show Details)

Please don't assign developers

sorry just noticed that i unassigned your assign to Antonio accidentally while making changes to task at the same time - will not further

Richard Antalik (ISS) changed the task status from Needs Triage to Needs Information from User.Mar 24 2020, 8:07 PM

Since in 2.83 gpencil drawing has been changed a lot, please use only 2.83 to describe a bug. Technically, you should always use latest version to report bugs.

In any case, I can not reproduce this issue on Windows. Does this happen when you click on File > Default > Load Factory Settings?

Dmitry (Rezoob) added a comment.EditedMar 25 2020, 6:39 PM

Yes, it does - you can check screen recording video. At my old notebook (HP Probook 4720 with Mobility Radeon 4330 and Windows 7x64) "2D Animation" part doesn't work at all - when going to it or start drawing Blender crashes.

Dmitry (Rezoob) changed the task status from Needs Information from User to Needs Triage.Mar 25 2020, 6:55 PM
Antonio Vazquez (antoniov) changed the task status from Needs Triage to Needs Information from User.EditedMar 26 2020, 10:46 AM

You need to be sure to set the shading mode in material or render...you have enabled SOLID.

Depending of yor stroke, you must adjust the material position of the gradient, or you can use the new fill transform tool in Edit mode.

Also, be sure to disable lighting if you want the same colors. If you don't disable lights, the colors will be affected by any scene light.

Here you have an example file.

Dmitry (Rezoob) changed the task status from Needs Information from User to Needs Triage.Mar 26 2020, 11:09 AM

Thank you so much to taking into this. I checked everything that you've explained using your example, but the problem is still here - plese check new screen recording. I'm always checking with last build.

I've noticed that a mini-icon next to materials's name shows gradient, while bigger preview box shows Base Color right from start. As soon as i change any parameter of fill (tried Flip Colors and Blend in Fill...) the mini-icon changes to Base Color as well.

It looks some type of driver bug or limitation. It's normal the material icon changes when you modify anything, the original icon was saved with the file.

@Germano Cavalcante (mano-wii) @Clément Foucault (fclem) any idea here?

i was thinking to get back to 2.82 since back-compatibility of my animation is quite satisfactory (i didn't use newest features) and can retune array mod/blur fx, BUT 2.83 performance is, at minimum, twice better with GP!
So i'll definitely go next with 2.83 even without these two.
Any other macbook owner could test this?

It looks some type of driver bug or limitation. It's normal the material icon changes when you modify anything, the original icon was saved with the file.

@Germano Cavalcante (mano-wii) @Clément Foucault (fclem) any idea here?

I'm not sure which bug to look for. The Material Icons issue has already been reported here T74983

Dmitry (Rezoob) added a comment.EditedMar 26 2020, 7:45 PM

checked T74983 - no, "my" material icon works even better than expected. The material's Gradient and Texture properties changes do nothing with material - please check this

https://dev-files.blender.org/file/data/umthjsjq2xwzayg5i7ua/PHID-FILE-gtzf76xqdnmawa7th7lp/Screen_Recording_2020-03-26_at_12.54.14.mov

got something new on this - i've checked other experimental branches:

functions-blender-2.83-cf59daf62fd4-macOS

  • both Gradient and Texture WORK, Checker Box is present, But no new Vertex Color feature;

new-object-types-blender-2.83-728faf49b24a-macOS

  • DOESN'T work. Checker Box is absent, just like in Daily Build, new Vertex Color feature is here;

temp-clang-format-sorted-includes-blender-2.83-044a0ad18f09-macOS

  • DOESN'T work. Checker Box is absent, just like in Daily Build, new Vertex Color feature is here;

Could it be someway connected: Vertex Color vs Gradient+Texture+Checker Box?

I cannot reproduce the problem on:
Operating system: Windows-10-10.0.18941 64 Bits
Graphics card: Radeon (TM) RX 480 Graphics ATI Technologies Inc. 4.5.13586 Core Profile Context 19.50.01.05 26.20.15001.5006

This is a Mac issue for the OpenGL driver.
Sometimes we find workarounds in the code to solve these problems.
But for this we need a developer with the same setup to reproduce the problem.

Stas (girafic) added a subscriber: Stas (girafic).EditedApr 2 2020, 9:19 AM

For me it is broken on Blender 2.82a but works on 2.83. (screenshots attached, same file in different Blender versions)

System Information
Operating system: Darwin-19.4.0-x86_64-i386-64bit 64 Bits (macOS Catalina 10.15.4)
Graphics card: AMD Radeon RX 480 OpenGL Engine ATI Technologies Inc. 4.1 ATI-3.8.24

Blender Version
Broken: version: 2.82 (sub 7), branch: master, commit date: 2020-03-12 05:06, hash: rB375c7dc4caf4
Worked: version: 2.83 (sub 11), branch: master, commit date: 2020-03-31 19:14, hash: rB0062813c731f

Germano Cavalcante (mano-wii) changed the task status from Needs Triage to Needs Developer to Reproduce.Apr 2 2020, 3:04 PM

I tested on 3 windown systems (2 with AMD and one with Intel).
But I still can't reproduce the problem.
I suspect the error is between these lines: https://developer.blender.org/diffusion/B/browse/master/source/blender/draw/engines/gpencil/shaders/gpencil_frag.glsl$72-77

But this is a driver error (outside blender). I can't find a workarround without being able to reproduce it.

What would you try to change in this code?

I'm not experienced since i'm php-programmer with linux-server knowledge BUT as any programmer i know common things...

I already cloned Blender source and have success build using this step-by-step https://wiki.blender.org/wiki/Building_Blender/Mac. As IDE i would rather use VSCode with Clang-format Extension... (should be simpler at this step to use and build just from terminal than using huge XCode)

So if you could tell me what to try, i can make tries and check with bulds on my hardware. Could you assist me?

Found something even interesting: when using Stroke Texture with Fill enabled, it shows Stroke Texture inside Fill + Gradient! (Video is attached).

also experiments with gpencil_frag.glsl show that "else if (GP_FLAG_TEST(matFlag, GP_FILL_GRADIENT_USE))" condition doesn't happens - it always goes to "else /* SOLID */ {"... if replace with "true" - gradient works somehow BUT mix color doesn't have any affect - just base color goes into white/transparent.

What would you try to change in this code?

Good to see that you can take a look deeper into this issue.
I don't think I can give you any better direction than pointing out where the code might be buggy.
Knowing where the problem may be, there is not much choice but to change lines and test.
There are programs that allow you to do this in real time, but in your case, change that line, compile and check (several times)...

I, for example, would start by erasing some lines and checking for the resulting color if the code gets where it should:

diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_frag.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_frag.glsl
index 8c2032f834a..ecb1a2d8c0d 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_frag.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_frag.glsl
@@ -70,30 +70,13 @@ void main()
     col = texture_read_as_linearrgb(gpFillTexture, premul, uvs);
   }
   else if (GP_FLAG_TEST(matFlag, GP_FILL_GRADIENT_USE)) {
-    bool radial = GP_FLAG_TEST(matFlag, GP_FILL_GRADIENT_RADIAL);
-    float fac = clamp(radial ? length(finalUvs * 2.0 - 1.0) : finalUvs.x, 0.0, 1.0);
-    int matid = matFlag >> GP_MATID_SHIFT;
-    col = mix(MATERIAL(matid).fill_color, MATERIAL(matid).fill_mix_color, fac);
+    col = vec4(0.25, 0.5, 1.0, 1.0);
   }
   else /* SOLID */ {
     col = vec4(1.0);
   }
-  col.rgb *= col.a;
 
-  /* Composite all other colors on top of texture color.
-   * Everything is premult by col.a to have the stencil effect. */
-  fragColor = col * finalColorMul + col.a * finalColorAdd;
-
-  fragColor.rgb *= gpencil_lighting();
-
-  fragColor *= stroke_round_cap_mask(
-      strokePt1, strokePt2, strokeAspect, strokeThickness, strokeHardeness);
-
-  /* For compatibility with colored alpha buffer.
-   * Note that we are limited to mono-chromatic alpha blending here
-   * because of the blend equation and the limit of 1 color target
-   * when using custom color blending. */
-  revealColor = vec4(0.0, 0.0, 0.0, fragColor.a);
+  fragColor = col;
 
   if (fragColor.a < 0.001) {
     discard;

In this case the resulting color should be vec4(0.25, 0.5, 1.0, 1.0) (I have not checked).
If the color is not this then the code did not reach where it should, making me suspect:

  • matFlag can be wrong or
  • compiler is really buggy

Next step would be to delete more lines and check matFlag from the resulting color.
There are many possibilities, I can't list them all.

Dmitry (Rezoob) added a comment.EditedApr 6 2020, 9:43 AM

Thanx!

Made some tests:

...with your code example both stroke and fill become just WHITE.

...it it looks like i'm always getting revealColor:
revealColor = vec4(0.0, 0.0, 0.0, fragColor.a);

...so if i make these changes:


...i see BOTH stroke and fill default rcol (switching fill type doesn't change anything) - looks like if-gradient condition doesn't happen.

Any ideas?

Dmitry (Rezoob) changed the task status from Needs Developer to Reproduce to Needs Triage.Apr 17 2020, 12:39 PM

For me it is broken on Blender 2.82a but works on 2.83. (screenshots attached, same file in different Blender versions)

@Dmitry (Rezoob) Can you try 2.83 at https://builder.blender.org ?
Also for dev help, feel free to drop into https://blender.chat > #blender-coders

Opened the file Antonio gave, I see all green. But file browser's thumbnail shows gradient. Is that thumbnail stored somewhere or generated on the fly.

rB55a2682348df
Operating system: Darwin-18.7.0-x86_64-i386-64bit 64 Bits (10.14.6)
Graphics card: Intel(R) HD Graphics 6000 Intel Inc. 4.1 INTEL-12.10.12

Checking now in the version Stas mentioned, since there's some color flipping going on.

The icon is saved, so maybe it was generated in my system with my GPU, but the final image in Viewport is generated on the fly for your system, this is why you see a green screen but a good icon.

Ankit Meel (ankitm) changed the task status from Needs Triage to Confirmed.EditedApr 21 2020, 8:43 PM

I didn't get a gradient in

I'm on Mojave (Intel HD 6000), both Stas (AMD RX 480) & Dmitry (Intel iris Pro OpenGL ) are on Catalina.
I made a file:


it opens red(base color) on Mac, green(secondary color ) on windows, with no flipping checked. So confirming.

All gradients show and work fine on OSX 10.14.6:

System Information
Operating system: Darwin-18.7.0-x86_64-i386-64bit 64 Bits
Graphics card: AMD Radeon Pro 560X OpenGL Engine ATI Technologies Inc. 4.1 ATI-2.11.20

Blender Version
Worked: 2.83 (sub 15), branch: master, commit date: 2020-05-06 16:18, hash: rB9605c2616696

Checked Ankit's T75061.blend with lastest 2.83b (downloaded right now) - no gradient as well.

hey, there is one more problem while inserting texture(.png file) to the material for GP, the blending option does not work properly, it worked fine in 2.82 as it did not have the blending option. i saw a tutorial in which blending option was working fine, i guess he was using windows but in mac we have this issue.

Dalai Felinto (dfelinto) changed the subtype of this task from "Report" to "Bug".Sep 8 2020, 5:55 PM

@Clément Foucault (fclem) is this a regression that we should focus on?

re-checked: problem is still present in 2.90

Fantastic! Can't wait newer alpha bild to check it