Material used in UI distorting on Android

I am using a Material that animates a Spritesheet in UI, material itself is really simple:

Material works perfectly on Windows, but it keeps distorting when on mobile, example here:
(The swirl background, the logo, the loading bar and the flying guy use the same material)

There are a few threads saying that texture size for mobile should not exceed 2048x2048, however I downscaled the spritesheet to 2000x1600 and it still gave the distortion effect

Is there a rendering/packaging setting I am missing here?

I also couldn’t really find an alternative way to play an animation like this in UI, so couldn’t test that

did u use a scalebox?

No, this is the Widget layout:
Just images with the specified materials, 1 normal background image and some text

What you can do actually you can make an overlay first and put your image inside (material), please do put sizes exactly like 1024*1024 or whatever.

After this wrap your overlay with a size box-> in settings fit the horizontal aspect ratio 1 for min max

this would always keep your image proportional whatever device is

Think it should solve your problem of scaling without any use of code or image resizing.

Let me know if you can get it work.

I tried your method but it still distorts like in the original video

Im not even sure if the image size is the issue but that’s the only relevant piece of information I could find!

This is a real interesting one, I was thinking about this. As we tried its not about power of 2 or scaling of umg. I would like to mention that I know most of the image compression fundamentals however I am not familiar with mobile settings. However I would try:

1-Can be maybe related to compression since I see that some frames are good quality. Still is good to check image sequences compression settings are right. Texture group is UI with no mip maps.
2- I highly doubt that its related to material since its quite simple material with a flipbook with the correct time node. However it is looping and lowering resolution with time loop. So I feel there could be some mip map streaming issue over there.

Remove and try without color correction.

If it works, then as i suspect you math is wrong/going out of 0/1 range.

Yeah it’s been really frustrating, I’ve delayed and come back to this issue a few times already

The power of 2 in umg, is that what your earlier solution was for? Since the original image is not in a power of 2. The spritesheet is 6912x5750 and one individual image in the spritesheet is 1152x1150

  1. The image texture group was set to 2D Pixels (unfiltered) with Mip Gen Settings to Unfiltered. I put these to UI and NoMipMaps respectively but still no change in behavior on mobile

  2. What do you mean with it looping and lowering resolution? Sadly Im not very good with Mipmaps or textures in general.

Would it helped if I sent the texture used?

It was broken before I added the color correction, however I will try again.

Originally the material was applied in a Retainer box on top of the actual image, which automatically applied the color correction but since I removed it I had to add that manually

Just tried and it has the same distortion and the color is bleached from removing the color correction

power of 2 in umg doesnt’t really matter since that is not compressed but image is. So I would suggest making them power of 2

All right, will try to rescale them to be square, will also try and import a random flipbook from the internet to see if it has the same issue, will be for tomorrow though

Compressions shouldn’t affect the flip book. But do try anyway.
It’s best practice to just use a power of 2 image.

Update this id it doesnt fix.

Validate and clmap your stuff though.
No excuse for not doing it right if you are going to have dynamic values.

Prevent someone from putting a 2 in there and driving the flip book function out of range…

All right so I tried by making our individual sprite 256x256 (total spritesheet didn’t exceed 2048x2048) but that didn’t work either.

I then proceeded to try one from the internet, the spritesheet was 1024x1024 and there were 9 columns/rows (so individual sprite wasn’t a power of 2) but that didn’t work either.

I am not sure what you mean by ‘validate and clmap’ my stuff, if you wouldn’t mind explaining that further

However, I did find a workaround by going on event tick, and manually looping through a paper2d Flipbook.
Ended up finding it from this video, didn’t know this was even possible:
https://www.youtube.com/watch?v=GFc0hGx8MOU


Note to others: this uses a hardcoded frame delay, which doesn’t really work for modern games since some people will have 60 fps and some might have 480 fps. If I remember I will upload a better code alternative later

While not ideal, this should suffice for my usecase. If you guys are willing to find the actual issue with using the materials I am still down to help, just in case someone else has a similar issue

1 Like

interesting then there is a problem with the time node over there whatever is happening i assume, while loading maybe something happening to time since if this is worrking and other is not then issue is time imo

I’m not sure about that either, but hey it’s such a weird issue you might be right.
Just glad I found an alternative that fixes it.

To summarize my alternative fix for anyone who might need it, I took the approach used in this youtube video and changed it, so it’s based on animation speed instead of framerate.

Alternative way to do this is by making a Paper2D Flipbook from a bunch of sprites, then calculate on Tick event which frame needs to be displayed next.

Blueprint code overview:

Part 1: Checking if a new frame needs to be displayed

Part 2: Creating a brush from the image, assigning it and incrementing + modulo on the current frame

Swirl Animation is a Flipbook reference
Swirl Image is an image in the UI

CurrentFrame & Timer default to 0

The issue is likely thay Time times Something produces results outside a 0 to 1 range.

Or, that something was modified in the flipbpok function by which the individual frames are no longer displayed correctly.

Try filming the error with Slowmo .5 so you get more frames to look at.

The other issue could just be transparency calculations on sort priority of UMG.