Nine patch showing gaps with alpha png

Demo:

5.2.0:
image

4.2.1:
image

Seems a regression in 5.0

I notice that only the alpha channel has gaps:

Besides the fix, any workaround now? We had upgraded our product to 5.0.

cc @DarraghBurke

Copy the GUI.Image code from 4.2.1 as a workaround.
Guess the bug comes from fix GUI.Image source set · BabylonJS/Babylon.js@f7a320e · GitHub
Because I tried this file but no luck.

I have no time to dig into it now so attach them here.

Looks like the issue originates from this PR, which updated the nine patch code: P8/nine patch patch by Pryme8 · Pull Request #9797 · BabylonJS/Babylon.js (github.com)

I’m going to do some investigation and see if I can figure out what caused the change in behavior, but @Pryme8 may know more about this.

Might have missed fixing it for the alpha texture sample maybe? I’d have to look when I get back into town next week.

Bet it’s my oversight and I’ll take care of it unless someone wants the glory.

1 Like

I knew this PR and had the same guess at first. So I used Babylon.js/image.ts at f7a320e47ee0683e7f1006a26c374e6221dc89c5 · Pryme8/Babylon.js · GitHub

It’s broken too. Weird?

I know what’s happening. Because the alpha values are partial and we had to add a one pixel overlap on the draw to get rid of gaps on some browser, so what we are seeing is that overdraw adding to each other.

I know the solution but it will take some changes when I get back into town next week.

Great!
BTW, just curious, you mentioned “some browser”, I also notice that the PR fixed gaps on Firefox. But I tried the PG on Chrome, Safari and Firefox on Mac, all have a gap. I wonder what’s the difference for browsers? Some texture-related stuff? Maybe this issue can get me to a deeper understanding.

I forget now sorry, wish I had more specifics for you. Might remember more as I look back at it but it’s been such a long time I honest don’t remember any of the actual specifics. But from what you are saying it sounds like some stuff maybe have changed again then.

If I remember right it was something about partial pixels rendering different per each of those clients, but like I said it’s been so many projects/lines of code between then and now that I am like Gandolf in Moria “I Have No Memory Of This Place At All”. I will get it fixed though.

1 Like

Thanks. Got it…
I had something similar about half pixel in other project.

1 Like

Just got back into town tonight, Ill take a look at this in the next day or two.

4 Likes

Still going to fix this. I already know the solution just need the time to get my hands on the keyboard. Should be before the end of the week though.

3 Likes

I can confirm that my fix works, but I am scared to post a PR due to this:

UPDATE
It builds so I guess ill just do a PR and worry about why my PG is broken later.

4 Likes

This issue has been here for a while. If you manage to fix it, you’ll become my new hero :man_superhero: :wink:

My bad for taking so long it was an easy fix, I just have been overwhelmed here lately with work, travel, and dadhood.

4 Likes

Man! I can totally understand :smiley:

2 Likes

Just to make this clear, I was actually speaking about the original issue that was here in v4 (but from you reading I kind of understand that it had been fixed in between time and reappeared ‘partly’ broken again with the latest changes. I wouldn’t dare saying ‘for a while’ speaking of just two weeks or even a month.
And there are things more important in life than BJS (even though BJS is indeed important :wink:

1 Like

:clap: :clap: :clap:

Thanks, man !