Weird path rendering phenomena?

So, i have a weird phenomena here i cannot get rid of:
here I am using a gradient to stroke a path.
The path is just an open path.
Sometimes (depending on the path’s shape) I get these weird horizontal pixels rendering.
like the one in the top here.
If I use solid color, this does not happen.
It also happens to rounded rectangles with fillPath so it is not an issue with the stroke function.
It does not happen with the software renderer

This happened ever since I updated to 7.0.2
I have not tried to downgrade to 7.0.1 yet, but that is my next step.
Using MacOS Ventura 13.0.1

Any suggestions or input is welcome!

here is my code:

g.setGradientFill(isMouseOverOrDragging()?gradH:grad);
g.strokePath(round, PathStrokeType(2.f, PathStrokeType::curved,PathStrokeType::rounded));

Screenshot 2022-11-20 at 3.53.08 PM

3 Likes

I’m having the same problem, I’m on the latest JUCE develop tip. This is from an iphone SE on iOS 16:

IMG_E0015

I would suggest bisecting over JUCE to find the exact commit which broke this. This sometimes provides a lot of insight on the problem, and sometimes even a workaround in the form of a simple revert commit.

2 Likes

Hi there, have you found a solution to the problem or found which commit caused this to start happening?

Bump :slightly_smiling_face:

If I attach an OpenGL context the artifact disappears. But this isn’t an option because on iOS the performance suffers a lot.

I wish I could help investigate the cause, but I am seeing this on an iOS 16 device and I can’t debug iOS 16 properly (I’m not on Xcode 14 yet so I can only install the app via Archive).

If the JUCE team are looking into this or if anyone has some tip that would be great.

2 Likes

If you can make a code example then I could check if this also reproduces on my macOS 12.5 setup.
If it does then I could try bisecting it.

The snippet in @assaf’s initial post refers to variables such as grad and round which are not included in the snippet, so I can’t make use of that one for a quick check.

1 Like

So, I managed to get this to disappear by adding the following preprocessor definition:
JUCE_COREGRAPHICS_RENDER_WITH_MULTIPLE_PAINT_CALLS=1

It only happens on the Core Graphics renderer

To recreate - set a ColourGradient and stroke a wriggly Path and try to animate it.
The artifacts will often appear - it has to do with the shape.

I am unable to dig into this further at this time, as the pile of paperwork on my desk has almost reached the ceiling! Hopefully, January will be calmer.

3 Likes

JUCE_COREGRAPHICS_RENDER_WITH_MULTIPLE_PAINT_CALLS=1 gets rid of the artifacts in my case as well. Thanks @assaf!

2 Likes

I don’t think this has been addressed yet, and it seems weird there needs to be a hack to make something so basic work…
Please advise

I was under the impression this got fixed at some point, can’t remember when though. I have seen no artifacts for a while now, even without the multiple paint calls preprocessor definition. Are you on the latest JUCE version?

I’m filling a path with a color gradient and getting a lot of artifacts when the editor is shown the first time.
Screenshot 2024-05-03 at 18.13.56
The succeeding paints don’t produce any artifacts. The artifacts appear on random places every time the editor is shown for the first time. They won’t appear after closing and reopening.

Setting JUCE_COREGRAPHICS_RENDER_WITH_MULTIPLE_PAINT_CALLS=1, as suggested, seems to remove the problem, but is this a real solution?

I searched occurrences of the macro, but didn’t become much wiser. Something to do with metal and low level core graphics. Does anyone know what that does? and i guess most importantly, whether it has any side effects i should be aware of? Is this only effective during initialization? as that would seem to suffice in my case.

macOS / JUCE 7.0.9

1 Like

Bump!

1 Like

So you are still having this issue? How and when exactly do you see the glitches? (JUCE version, target, etc.) I am doing similar things with paths and gradients but haven’t seen the glitches for a while. The glitches seem to appear only under very specific circumstances so it might be difficult to debug this without further information.

1 Like

This certainly seems to be the case, so I doubt we’ll be able to make any progress without some example code that reproduces the issue. It would also be helpful to know the following:

  • The exact JUCE version you’re using
  • The full set of JUCE preprocessor definitions you’re using (ideally, supply a cmakelists or jucer project alongside any sample code)
  • The exact macOS/iOS version where you see problems
  • The deployment target version
  • The version of Xcode you’re using to build
1 Like