Sprite Animation Node

Since animating sprites or video textures don’t currently work out of the box in UPBGE EEVEE, I put together a node group that will allow something similar by using a sprite sheet and animating it’s values.


In the video there is five separate planes (each uv unwrapped) with the same material and a 2048x2048 Blender generated Color Grid used as the sprite sheet.


Within the material there is two separate “Sprite Animator” nodes that are assigned by the Object Index/Pass Index. The larger plane is set to Pass Index 1 and sequentially cycles through all 256 “sprites/frames”, while the four small planes are set to Pass Index 0 and are animated to only cycle through a column that is assigned randomly(the same can be similarly done for rows). A use for this can be to have an 8x8 flame sprite sheet with 8 different rows of flames and using the Object Info node to randomly assign a row to each object and then animating the frame value for a 1 to 8 action. The last step would be to set up the action actuator within one of the objects that contains that material. Something that would be helpful would be if an object’s Pass Index could be controlled through properties or animations so that an object can toggle animations within its material.
There is more I would like to add and modify so any feedback is welcome.

At some point some of my .blend files crash blender if I delete an object after reopening them. This has happened for almost all builds of UPBGE EEVEE but not for all files. Whenever this happens I just reopen the file and before doing anything else I create a new scene (New/Copy Settings/Linked Copy/Full Copy) and delete that same scene, and somehow that prevents it from crashing. The blend file attached has the above issue on my computer, so try my solution or append the node group “Sprite Animator” to another .blend.

Sprite Animation Node.blend (1.8 MB)

7 Likes

Nice. Thank You. That remember me to my TileTex5in1 Script from pre Shader Times. :smiley:

Just use object color and add it to the uv,

Have it start at bottom left.

I have a recent post in resources.

You can key frame object color to make sheet animations (you have to choose the flat interpolation mode)

This gives you the ability to drive hundreds of Obj individually

2 Likes

After nearly a year since the last release I have an update.

SA v2

This past week I started a project that includes this node and realized a major issue involving aspect ratio. Up until now I was only using images with an aspect ratio of 1:1, but realized that that was the only ratio it worked properly with. I started from scratch and made a version that works with any aspect ratio/image dimensions.

The video below shows a comparison of the two versions with materials that contain textures with different aspect ratios. There are two planes with a 3:11 Color Grid texture (33 frames) and two smaller planes with a 5:1 custom texture (goes from 0 to 9 and then a “water drop” animation, 20 frames). All planes were unwrapped with cube projection and scale to bounds enabled. The planes on the left were rotated by 180 degrees.

The first version was built around point mapping while v2 was built around texture mapping.

Other changes include the addition of Column Offset and fixing change in frame where frame 1 would be .5-1.49 in v1 to 1-1.99 in v2.
For best results unwrap with cube projection and enable scale to bounds.
Sprite Animator v2.blend (736.4 KB)

3 Likes

Hi,
I have integrated your node algorithm into a new node for UPBGE.

I haven’t pushed the code because i don’t know if you want to license your blend with a restrictive license.
I want to ask you first if you give us permission to integrate your algorithm into the UPBGE.

6 Likes

Go right ahead. I made it to be used with UPBGE so I’m more than happy for it to be included.

6 Likes

This is awesome!

Great!!. Thanks a lot.

1 Like

Super nice! I was looking for something like this. I could vaguely remember someone made a node setup so you could some sort of a grid and the offset it per object. I could get this figured out properly.

Im trying to make flipping magazine test, using a nice tutorial from BlenderTemplates; https://www.youtube.com/watch?v=8Z2wXdSHaPU
I could easily do tons of manual work with UVs tons of mats and tetures. I want to make a big grid with magazine pages. With this nice node try i can reuse the same group, i still need different materials. But its way easier to control the pages now

1 Like

Sprite Animator v3

Just want to share some of what I’ve been working on the past few days. I plan on releasing it soon but need to test it to fix some issues.

1 Like

Sprite Animator v3 Release

The main purpose of this version was to add the ability to tile a selected frame and to randomize tiles.

Two ways to scale tiles:

  • The one built in to the node group is by changing the values of “Column Scale” (column width) and “Row Scale” (row height).
  • The second would be by manually scaling the uv map

Tile randomization:

  • “Randomize Seed” changes the position of the voronoi texture that determines the order of the tiles
  • “Random Column” and “Random Row” values are used to select the number of following columns and rows used for the randomization. A value of 1 will use the current column and row. Only positive values are supported for “Random Column” and “Random Rows”.

– ex. A 9x9 sprite sheet that’s on the 8th frame with “Random Column” set to 4 and “Random Row” set to 2 will use frame 8,9,1 and 2 from that first row and frame 17,18, 10 and 11 from the next.

To be worked on / Issues:

  • Tiling can cause bleed/outline of surrounding frames in the sprite sheet. Not an issue issue with texture interpolation set to closest and not present in smart or cubic if the frame’s borders are transparent.

  • Tile randomization can create “clusters” of the same frame near each other

Download:

1 Like

Sprite Animator v2.1

This update serves as a slight rework due to being able to use integers and booleans as input in node groups and to also add the option to flip the sprite vertically(Y) or horizontally(X).

Note: This version of the node was made in UPBGE 0.42.0 and tested in Blender 4.0.2. No prior versions of UPBGE or Blender were used for testing so backwards compatibility is not guaranteed and probably unlikely. If testing in older versions of Blender/UPBGE, use a new blend file or make backups beforehand!

I plan on updating v3 with the same changes but it needs other parts to be reworked aswell.

Download: Gumroad

2 Likes

There was some things I overlooked from this version and didn’t notice until working on v3.1. I reworked it once more, so if downloaded after this reply, those issues should not be present.

Sprite Animator v3.1


This update has the changes included in v2.1 and a refactor in how tiles are randomized. White noise is used for randomization instead of voronoi.

Pro/Con: When the tile has randomization factors on and is scaled the noise texture changes and so will the tiles. It’ll be as if changing scale also changes the “Seed”.

Download: Gumroad