HOW2inAE make a cube.

With not enough climate, and too much weather to talk about recently, here is another in the Adobe After Effects tutorial series.

This is an accurate and reasonably simple way to make a controllable 3D cube in AfterEffects.


I recently encountered an AE tutorial where they made a cube. By creating each face separately and moving and rotating each face into position. It was not easy, and required a lot of adjustment. This method dates back to the time when 3D programs did not provide preset regular solids. Everything had to be made by inputting vertex coordinates!

If you can slave, or parent one item to another so that its position/rotation is relative to that ‘parent’ then there is a simpler way of making the platonic, and many regular solids. A cube is easy, I leave as an exercise for those watching making a dodecahedron!

SCRIPT

1st to make a composition to put the cube on; standard size; create a background with gradient on it and then add a camera

Then make the comp that will be the cube face. This should be square, and of sufficient resolution to display any image or animation that you want on the faces of the cube. The size of the cube-face comp can be around 1k, a 1080 square comp is a good option.
I am using a filled layer with a mask to outline the comp, then a shape layer, and a text layer to put some design on the surface. This can be replaced or overlaid with other images after construction. Make sure all the layers are set to 3-D and rasterised.

In the main comp create a null layer, make it 3D and ensure it is at the centre. Reset its transform parameters to make sure if needed. Add the cube-face and make it 3D. It should also be at the null centre. You can rename the null cubecenter.
Move the cube face in front of the null by HALF of its size, so if it is 1080, move it forward to -540 in the Z direction. Name this face ‘Front’.

Then duplicate the cube-face and parent it to the null. Rotate the null by 180. (the video has an error, the “one” got clipped from the audio, it SHOULD BE 180 degrees) Positive or negative, in the Y axis. This should rotate the duplicated cube-face to form the back of the cube, so name it ‘Back. Unparent from the cubecenter.

Duplicate the front and back layers, and parent the duplicates to the Null. Rotate the null a further 90° this will form the left and right sides of the cube name accordingly.

You can repeat this procedure for the top and bottom. Be carefull to unparent cube faces that are already positioned and just move the duplicates by rotating the null 90 degrees. Take care to un-parent the front, back, left and right faces when rotating the cubecenter with the duplicates linked. Rotating 90 degrees in the Z axis should work on duplicates of the front/back faces.

Select the cube centre and the cube faces and pre-compose them, then rename that cube make sure that it is set as a 3D layer and rasterised, the little star on the left of the layer settings.

In the cube layer ensure the cube centre is reset to its natural position with all the layers unparented and then parent all the cube faces front and back left and right onto the cube centre . You can reorder the faces to try and avoid overlay problems…

back in the main comp create a new null make it 3D then parent the cube layer to it.

It is then possible to animate the cube position, scale and rotation by animating the cube control null.

I will edit out the endless adjustments and show some examples rendered out at the end.


You should be aware that not all effects work properly on 3D layers. For instance the audio spectrum effect used here does not map onto the 3D space of the cube, but onto a 2D projection of the cube in the main ‘stage’ composition. However the ‘wrong’ projection still works well. Other effects, procedural noise, Vegas and echo can also misbehave., even if the cubeface with those effects is pre-composed and rasterised.

Any of the cube faces can be replaced with a composition adjusted to size with a existing video or word animation however.

To animate the cube to music, add the sound file to the stage composition, convert the audio to key-frames via the ‘key-frame assistant’ menu and link from the cube-control null, scale/rotation/position to the audio key-frame ‘both’  slider. Modify the expression to get the amount of change you want.

If you add a light and a floor/wall the cube will only cast a shadow from those elements that are set to cast shadow in the base cubeface composition (not the total cube) this enables just part of the cube to cast a shadow. In the example shown, the outline of the cube only cast the black shadow, the audio spectrum and circle pattern do not.

This method of creating a centre, then rotating the shapes around that centre by linking/parenting them can be used to make a wide variety of shapes. If you are prepared to work out the maths.

Advertisements

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