Download

Help cropping texture atlas for use in UMG

Hi,

I want to use a texture atlas which I made using TexturePacker for my UI stuff.

Could someone tell me how to setup properly a material for use in UMG images from a spritesheet texture? I have tried TextureCropping nodes and stuff but didn’t get any success :frowning:

Dredok

I got this to work recently using the FlipBook node, assuming you want to display each individual item from the texture atlas and not make a bordered window.

https://docs.unrealengine.com/latest/images/Engine/Rendering/Materials/Functions/Reference/Misc/FlipBook_Demo.jpg

You’ll hook a scalar parameter into the animation phase slot, and then you will have to create an instance of the material. After that, when you use the material, you can change the scalar parameter to change the frame of the texture atlas.

Thanks rcapote! I experimented with flipbook before but discarded. Now I discovered that I can put float values in number of rows and columns, achieving effectively a texture cropping!

Now I want to know how to preserve the aspect ratio of my original cropping. Here you can see my current setup

Capture.PNG

It’s a lot more difficult when the sprites are different sizes like that. The best way to do it with the flipbook node is just ensure each sprite is the same size. So say if your biggest sprite is 64x64, every sprite in the atlas takes up a 64x64 section. Otherwise you would have to make an array with custom UVs for each sprite or something.

well that would not be a problem because I can use Parameter nodes and/or different material instances.

I have found another problem tho, Flipbook node seems to be ignored in UMG :frowning:

I was able to get it to work in UMG.

Hi, I had to note I want to use it in mobile. Then the node textureObject is not allowed, that’s the reason my material setup looks different, using texture sampler and custom uvs. With my setup I can not make it run in mobile.