Rotated UIGradients, wrongly apply their gradient to objects inside SurfaceGui, if SurfaceGui has weird structure. (Roblox player only)

So, for a 2 weeks I’m trying to combat problem in my minesweeper game: In Roblox player, almost al tiles have black artifacts:


I have tried everything, and found reason now: in my scenario, UIGradients apply wrongly.
For the sake of understanding, I’ll use the following gradient:

0 = Red
0.5 = Green
1 = Blue

Let’s look how unrotated gradients look:


Now, let’s rotate them by 45 degrees…

All tiles have AlwaysOnTop set to true, so there shouldn’t be any noticeable diffirences in coloring, yet there are some:

Now, let’s apply to our 0 rotated gradient transparency:

0=0
0.5 = 0
0.501 = 1
1 = 1

What I expect is to have 50% clipped image and text, but…


Look at this 2 tiles with 1 on them - they are diffirent. That are tiles I have shown separately before.

Resetting rotation to 0 fixes that. But sadly I need exactly 45 degrees (45, 135, 225, 315)

Now, I need to shown how my “numbers” are even made. This will be done in studio:


This’s a regular number tile.

To make it wrap around map, I use 2 SurfaceGui per tile. Each SurfaceGui has fixed Canvas size, equal to 120x120 pixels

Let’s separate them, and toggle background.
As you can see, they are rotated.

With 0 rotation, this will be turned into:

Every tile, including which are shown previously, use exactly same system.
Again, Studio hasn’t this bug, while Client has.

Expected behavior

I expect UIGradients to work propely, and not produce artifacts under any possible circuimstances.

Ikk this may sound stupid, if you want, you can use decals on meshes, and it automatically wraps around it, but idk how to add gradients on that

In my case I need SurfaceGui, so it will allow me to apply dynamic numbers, tile types and such. If I use skinned meshes, then I’ll need to make tons of layers for all needs.

2 Likes

Hi, we recently deployed a fix to studio for this and was waiting for it to be stable to turn on for client, that might be the reason you see the difference in studio and client. We just turned the fix on for desktop clients, do you mind checking again if it is working for you? Thanks

Yes, it works for me like needed now:


It now looks just much better. Thanks!