Blender: How to Loop an Image Sequence into Textures

Animating Blender Textures With Processing

Animated textures in Blender is a thing! Immediately after finding that out, I set out to script a grid crawler texture in Processing. Because no one in their right mind would want to draw that by hand.

A Bit Of Everything has a post with the logic for a static grid, but somehow getting an animated version ate 3 hours of my life. All in all, it took about 12 tries. What I love  about Processing is that even bad guesses can have pleasing results.

BadTries

This thing below. That’s all I wanted. Animated grid lines. Wierdly satisfying, right?

Grid Crawler Texture

The script is actually not that complicated. It can be done with three variables, a while loop, and a for loop.

The Processing Code

Couple things to note here. Setting the X or Y increment to a higher number will give you a more spaced apart grid. Also, you have to update the file path. Using the variable i will ensure that Processing doesn’t save over the same image over and over again.

int x = 0;
int y = 0;
int i = 0;

void setup(){
size(700, 700);
background(255);
strokeWeight(1);
stroke(0, 0, 0);
}

void draw() {
while(y<701){
for (int x=0; x<701; x=x+50){
line(x, 0, x, y);
line(0, y, x, y);
save("C:\\Users\\Desktop\\Test" + str(i) + ".png");
i++;
}
y=y+50;
}
}

How to Add the Texture in Blender

The images need to be numbered sequentially for this to work. Start off by adding your object. Unwrap it and assign it a new material.Then go into the Node Editor and add an image texture.

Step 1

In the image texture node, click Open. Navigate to the folder that contains the images you want to use, highlight them all, and click Open Image.

Step 2

If all has gone well, you should now see a fifth box set to “Image Sequence.” Below that, you’ll see the number of frames you have loaded. And that’s it. Hit play. Watch it move.

A Blender Scene

Advertisements
Tagged , , , , , , , , ,

8 thoughts on “Blender: How to Loop an Image Sequence into Textures

  1. ARJ says:

    XD you just motivated me to post more processing logics

    Liked by 1 person

  2. This is a pretty neat idea. What a few lines of code can do. Thanks for sharing 🙂

    Liked by 1 person

  3. ChasCraftMC says:

    gifGuide2Code, sorry for my minecrafty name. But can you continue the blender tutorials, I like them and I am a beginner/newbie at blender at the moment so I need tutorials. Thank you 😎😎

    Liked by 1 person

  4. constrain3d says:

    Great job! I agree. #11 was pretty cool!

    Liked by 1 person

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: