Flipbook: How do you Ignore Blank Space on a Sprite Sheet?

Hi guys -

Quick question - I’m using a Blueprint Flipbook (attached) to animate through a sprite sheet.

However, what do you do if the sprite sheet has blanks on it? (Since not every animation is going to be a perfect number of frames vs rows and columns).

It seems like something in the Animation Phase node is the key, and in fact adding in the Frac to this Time sequence seems to clip the amount of frames it plays through down… but I don’t want to do that because I also need to be able to set the animation’s speed, which seems to work without the Frac in this Time sequence.

Any ideas?

Thank you!

Skip empty space on sprites

Hi ,

I have exactly the same question. Did you find an answer by now?

best regards

Hello Unreal Community,

I’m also keep to learn a solution to this.
It seems like there are no reply to this question for years.

Could anyone kindly provide a solution to this?
Very much appreciated for anyone who can teach us how to solve this!

Thank you in advance! :smiley:

1 Like

Hi Guys,
I have just passed through this topic and saw that after so many years, no one replied. The answer is pretty simple.

  1. In the material, multiply the number of rows by the number of columns and subtract the value of empty spaces.

  2. Next, divide the result by the total number slots in your image. That will return you the percentage at which the animation ends in a normalized range of 0-1.

  3. Get a time node and connect the ‘frac’ node to it. It will make sure that time loops only from 0-1.

  4. At last, multiply your result from step 2 with the ‘frac’ node and connect to the animation phase in the flipbook. This result will loop from 0 to the last frame of the animation.

Below is the image showing how I made it UE5.

2 Likes

Hey I just wanted to say thanks so much for responding to this old post, your reply really helped me! Can you explain how all that logic works? It seems like black magic to me.

Hey,

I manipulate ‘Time’ to finish early before reaching a phase value (alpha) of 1. As a result, I cut out the last few frames of the animation. The ‘Frac’ node ensures that the moment ‘Time’ node reaches a value of 1, it will start over again, instead of continuing.

If I translate it into a mathematical equation it would be something like this:

Number of rows: x=5

Number of Columns: y=6

Blank slots: z=5

x*y=xy

5*6=30

Then

xy-z

30-5=25

Then

25/30=0.833

0.833 is our maximum new time as 1-0.833=0.167 and that value is the alpha percentage of the blank frames. In a short, frames are just skipped and time plays again.

Range wise it translates the alpha of 0 to 0.833 as 0 to the 25th frame and then 0.833 to 1 are 25 to 30 frames. In my example, I did not want these last five frames that’s why the skipped time is 0.167.

Hopefully, it did not get too convoluted.

Awesome! Thanks!