Skip to content
Home » Ordered Image on Disordered Blocks in Blender

Ordered Image on Disordered Blocks in Blender

Spread the love

Today we’ll be creating an animation with an image texture on cubes that looks disordered at the beginning and becomes ordered when all the cubes fall down and scatter across the ground. Naturally, this would be difficult to achieve in reality as things don’t spontaneously get more ordered than they were before, so we’ll start from the end and go in reverse. But first things first.

I’ll be using the 3.0 version of Blender. I’m going to use the following image by OpenClipart-Vectors from Pixabay:

ordered image

But you can use any image you like. Here’s what the cubes will look like before they hit the ground:

ordered image

Here you can see only part of the big cube of cubes because it will start off near the top of the screen and only move into view after a while, short before it hits the ground. You can see pieces of the image attached randomly (or so it seems) to the faces of the cubes. And here’s what they will look like after the animation finishes.

ordered image

And here you can see the animation:

So, let’s get started. Here are the steps for you to follow:

Step 1 – Add Physics to the Default Cube

This time we’re going to use the default cube. Actually, we’ll create lots of cubes using the array modifier, but before that let’s add physics to the original one so that we already have it on all cubes that we create. Go to the Physics tab (A) and select Rigid Body (B). We want the cube to interact with other objects. Set Shape to Box (C) and under Surface Response drag Friction all the way up to 1 (D).

Step 1 – Add Physics to the Default Cube

Step 2 – Create More Cubes

Now go to the Modifier tab and add an array modifier. We’ll create 8,000 (eight thousand) cubes altogether. First, in order to create a row of 20 cubes, set Count to 20 (A) and in order to add some space between them set Factor X to 1.1 (B).

Create More Cubes

Next, hover your mouse cursor over the Modifier panel and hit Shift + D to duplicate the modifier. You can hit the arrow of the first modifier to collapse it (A). In the second modifier leave Count at 20, but change Factor X to 0 and set Factor Y to 1.1 (B). Now we have 20 rows with 20 cubes in each.

Create More Cubes

Duplicate the array modifier one more time, leave Count at 20, set Factor Y back to 0 and set Factor Z to 1.1. This will create 20 layers with 400 cubes in each, so 8,000 cubes altogether.

Create More Cubes

Now we can apply the modifiers. Hit the down arrows in each of them (A) and select Apply (B).

Create More Cubes

Now it looks like there are 8,000 cubes, but if you look at the Outliner, there’s just one cube object. So, let’s make the small cube separate objects. Go to edit mode, hit P and select By Loose Parts. We added some offset between the cubes, so they are loose parts.

Create More Cubes

Now you should see all the new cubes in the Outliner.

Create More Cubes

Go back to object mode. The origin points are now all at the same location, the same as that of the first cube (A). Let’s change it. In the Object menu go to Set Origin and select Origin to Geometry (B).

Create More Cubes

Now you will see the origin points of the particular separate cubes where they should be.

Create More Cubes

Rotate the cubes so that one of the corners of the big cube of cubes points down, move the cubes along the Y axis (G Y) until the bottom-most cube is near the world center, then along the X axis (G X) until it’s near the center in this view as well and hit G Z 50 to move the cubes 50 units up.

Create More Cubes

Your Panda3D Magazine

Make Awesome Games and Other 3D Apps

with Panda3D and Blender using Python.

Cool stuff, easy to follow articles.

Get the magazine here (PDF).

Step 3 – Create the Ground

We need something the cubes will fall down onto. Let’s create a plane. Hit Shift + A and under Mesh select Plane. Hit S 120 to scale it quite a bit.

Create the Ground

We want the plane to collide with the cubes, so go to the Physics tab and select Rigid Body (A). Set Type to Passive (B) because it’s not going to be the object that bumps into other objects but rather the one that is bumped into.

Create the Ground

Step 4 – Test the Animation

Let’s test the animation to see if everything looks fine. To do that, hit the Play Animation button. You will see the boxes fall down and scatter on the ground. It may take some time, though.

Test the Animation

Some of the cubes are going to fall off the edges of the plane. We could scale the plane up, but let’s leave it as is. We’re still going to have enough cubes. Here’s the last frame (frame 250 by default) of the animation.

Test the Animation

Step 5 – Bake the Animation

As I just mentioned, there are 250 frames now. But this means we won’t have much time to watch the result once the animation is done playing. Let’s make it 500 frames. So, go to the Scene tab (A) and under Rigid Body World, under Cache, set Simulation Start to frame 1 and Simulation End to frame 500 (B). Set End in the Timeline to 500 as well to match (C). Then save your file and hit the Bake button (D) to bake the simulation. This is going to take some time.

Bake the Animation

Python Jumpstart Course

Learn the basics of Python, including OOP.

with lots of exercises, easy to follow

The course is available on Udemy.

Step 6 – Set the Camera

Let’s select the camera and align it to view. To do that, go to the View menu and under Align View select Align Active Camera to View.  

Set the Camera

You should now see what the camera can see, but probably you don’t see anything. This is because by default the camera can see only up to a certain distance, like 100 units. To fix this, go to the Object Data tab (A) and set Clip End to 1000 (B). Now the camera can see up to 1000 units, which is enough for our purposes.

Set the Camera

Go to the last frame. Now the camera should see the following:

Set the Camera

Now change Focal Length to 70.

Set the Camera

Next, hit N to open the sidebar. Go to the View tab (A) and check Lock Camera to View. Then, in the viewport hit R X and rotate the camera until it can’t see anything beyond the ground anymore. We now should get what we want. Here’s what the camera is going to see.

Set the Camera

Uncheck Lock Camera to View and hit N to hide the sidebar.

Blender Jumpstart Course

Learn the basics of 3D modeling in Blender.

step-by-step, easy to follow, visually rich

The course is available on Udemy and on Skillshare.

Step 7 – UV-Unwrap

We don’t need the ground for now. Let’s hide it. To do that, select the ground and hit H or click on the eye icon in the Outliner.

Before we move on, let’s clean the hierarchy a bit. To do that, we’re going to create a new collection for all the cubes. Right-click on Scene Collection in the Outliner and select New Collection. Rename the collection ‘cubes’. Then select the first cube, scroll down to the last cube, hold down Shift and select the last cube. This will select all the cubes. Then just drag them into the cubes collection. At this point the cubes should be still selected, but if you deselected them, just right-click on the cubes collection and click on Select Objects.

UV-Unwrap

Now, we can unwrap. Make sure you’re at frame 500 (A), which is the last one. Then open a new window on the left and set its editor type to UV Editor (B). Go to edit mode (C).

UV-Unwrap

Select all and make sure you’re in camera view. Now go to the UV menu and select Project from View.

UV-Unwrap

This is what you should see in the UV editor:

UV-Unwrap

Step 8 – Add the Image

Go to the Material tab, set Base Color to Image Texture and click the Open button. Select the image you chose to be displayed on the cubes to open it (A). It should automatically open in the UV Editor, but if it doesn’t, just select it from the dropdown list (B).

Add the Image

In the 3D viewport switch to render shading (A) and temporarily toggle off the Show Overlays button (A). Now you can see the image (C).

Add the Image

You can now toggle the Show Overlays button back on. We could tweak the UVs in the UV editor to adjust the image on the cubes to our liking, but let’s leave it as is.

Step 9 – Set the Light

Our image is rather dark. Let there be more light. Deselect all, go to object mode and select the light. You can also close the UV editor , we don’t need it anymore. Go to front view and hit G Z 50 to move the light up.

Set the Light

Go back to camera view (Num 0). With the light selected, go to the Object Data tab, set light type to Sun (A) and Strength to 10 (B). You can also rotate the light if you want to achieve a different effect, but I’m not going to do that.

Set the Light

This is what the image is going to look like at the end of the animation.

Step 10 – Add a Material to the Ground

Click on the eye icon (A) to unhide the ground. Select it and go to the Material tab. Add a new material and set its Base Color to white (B).

Add a Material to the Ground

Step 11 – Render the Animation

We’re ready to render the animation. Save your file before you start in case anything goes wrong. Go to the Output tab (A) and select a folder where you want the animation to saved (B). Set File Format to FFmpeg Video (C) and under Encoding set Container to MPEG-4 (D).

Render the Animation

Let’s make a test render. Go to the Render menu and select Render Image. This is the image you should get:

Render the Animation

Our test render is fine, this is the image taken at the last frame. Now go to the Render menu again and select Render Animation. After a while you’ll be able to enjoy your animation.


Spread the love

Leave a Reply