Skip navigation

# After Effects

Currently Being Moderated

## How to make a perfect cube

### Sep 5, 2012 9:38 AM

how can i make a perfect 3 cube in after effects?

i create a square side of the cube then changing everytime the anchor point (top, both side, and bottom) i duplicate it 4 times and rotate it to recreate the cube but they don't touch in the right way, i mean there is always some space or they fuse together... if i press ctrl or shift the program don't help me to make them aligned

how can i solve this problem?

to be faster can you just rell me how can i center the anchor point of a 3d layer? i mean center the Z value, the deep... if i set 0 the Z is on the figure

like on a 300x300 figure the Z point will be at 150, but on an irregular figure? how can i center it?

ive made it with solid, but i want to make it with rectangle tool, is possible? the Z anchor in solid is easy to set, just grap it to 150 if your solid is 300x300, but ho can you center the Z point with rectangle tool? is possible to make a cube with this tool without have to center manually a layer? with solid is easy just set the Z anchor to the theoric center (i hope you understand me at this theoric center XD i dunno how to explain) then duplicate 5 time the layer and rotate them of 90 degree to make the cube... very easy but with rectangle tool is a mess D:

Replies
• Currently Being Moderated
Sep 5, 2012 10:31 AM   in reply to LeeXiaoLoong

Drill down Contents properties of your rectangle until you get acces to Anchor Point and Position settings within Transform: Rectangle properties. Set them to 0.

|
Mark as:
• Currently Being Moderated
Sep 5, 2012 12:20 PM   in reply to LeeXiaoLoong

Do not confuse shape Contents Anchor Point with layer Anchor Point.

Have a look at both my comment and the screenshot above more attentively.

When you're done with aligning shape Contents Anchor Point, operate with layer Anchor Point and Orientation or Rotation under layer Transform property.

|
Mark as:
• Currently Being Moderated
Sep 5, 2012 12:49 PM   in reply to LeeXiaoLoong

Red Arrow indicates the shape Contents Anchor Point.

Green Arrow points to the rectangle size.

Blue Arrow indicates the layer Anchor Point.

|
Mark as:
• Currently Being Moderated
Sep 5, 2012 2:16 PM   in reply to LeeXiaoLoong

No, there is no such tool, but you can do that with expressions.

Alt/Opt + Click layer Anchor Point stopwatch and type [ (left bracket) 0 (zero) ,(comma) 0 (zero) ,(comma). Then pick-whip layer Anchor Point to either shape Size width (first number) or height (second number). Then type /2] (divide by two and right bracket) and hit Enter on Numeric Keypad.

Now you can change your rectangle size, and layer Anchor Point will be adjusted automatically.

|
Mark as:
• Currently Being Moderated
Sep 5, 2012 2:29 PM   in reply to LeeXiaoLoong

You can start from the Expression basics help section.

|
Mark as:
• Currently Being Moderated
Sep 7, 2012 2:43 AM   in reply to LeeXiaoLoong

Hey Eran Stern has a tutorial that makes this task "look" easy using something called "alternative parenting". Here it is STERNFX - However, I am on the board this morning because I can not get it to work as advertised in the tut. I'm getting a cross shape not a cube. Would be interested to see if anyone else can make it work. I believe I am following the instructions verbatim.

BTW here is an expression to make a cube. Credit goes to Colin Braley. I can't remember where I copied it from.

 Re: Box troubles by Colin Braley on Oct 23, 2005 at 5:49:54 pm

I have a quick expression you can apply to a layer to create a box, just make sure that each layer is the same size and is a square layer(use square pixels). Also, for the expression to work the layers that make up the box have to be the first six layers in their comp. It you want to move the box parent the layers to a null or something. If you want other layers to be above it precomp the box, bring it into another 3d cop and turn on the continuously rasterize/collapse transformations switch. Well with that said here are the expressions:

Here is the expression for position:

i = this.index;
if(i == 1){//front

x = thisComp.width/2;
y = thisComp.height/2;
z = 0;

}else if(i == 2){//Back

x = thisComp.width/2;
y = thisComp.height/2;
z = this.width;

}else if( i == 3){//Left Side

x = thisComp.width/2 - this.width/2;
y = thisComp.height/2;
z = this.width/2;

}else if (i == 4){//Right side

x = thisComp.width/2 + this.width/2;
y = thisComp.height/2;
z = this.width/2;

}else if(i == 5){//Top

x = thisComp.width/2;
y = thisComp.height/2 - this.width/2;
z= this.width/2;

}else if (i == 6){//Bottom

x = thisComp.width/2;
y = thisComp.height/2 + this.width/2;
z= this.width/2;

}
[x, y, z]

//--

Here is the expression for orientation:

i = index;
if(i == 1){//front

x = 0;
y = 0;
z = 0;

}else if(i == 2){//Back

x = 0;
y = 0;
z = 0;

}else if( i == 3){//Left Side

x = 0;
y = 90;
z = 0;

}else if (i == 4){//Right side

x = 0
y = 90;
z = 0;

}else if(i == 5){//Top

x = 90;
y = 0;
z= 0;

}else if (i == 6){//Bottom

x = 90;
y = 0;
z= 0;

}
[x, y, z]

//--

well there you go just apply that to a square ;ayer and duplicate it 6 times.

~Colin

|
Mark as:
• Currently Being Moderated
Sep 7, 2012 9:12 AM   in reply to BingoFriday

The easiest way to make a cube, is to simply offset the anchor point of a layer in Z by the layer width / 2,  then rotate 3 copies on the Y axis and 2 copies on the X axis.

Follow these steps. Let's say your layer is 200 pixels by 200 pixels. Set the anchor point to 100,  100, 100

Now rotate layer 1 90º on Y

rotate layer 2 180º on Y

rotate layer 3 270º on Y

rotate layer 4 90º on X

rotate layer 5 270º on X

There you go. You have a mathematically perfect cube. Mathematically perfect but light will still pas through the seams because of the anti-ailiasing of the edges.

If you change the blend mode for each layer to Alpha Add the seams will improve but some light will still pass through the seams. You can not eliminate this problem completely but clever designs can hide the problem. Try applying a mask to the outside edge of the offending layer (double click the rectangle tool with the layer selected) then add a stroke of the same hue but a darker color to the layer. The dark edge helps hide the problem on layers that show a bright edge like the back left face in this example.

|
Mark as:
• Currently Being Moderated
Sep 7, 2012 9:40 AM   in reply to LeeXiaoLoong

Here's a screen shot with stroke applied to hide the lighting problem

|
Mark as:
• Currently Being Moderated
Sep 7, 2012 12:45 PM   in reply to LeeXiaoLoong

Nothing is wrong with you. Both Rick's and BingoFriday's comments are about building a cube out of solids, not out of shape layers. When you select a solid layer and double-click Rectangle Tool, After Effects creates a mask around this layer. In case of a shape layer After Effects creates new shapes in the same shape layer. If you want to create a mask for a shape layer, select it, then choose Layer -> Mask -> New Mask.

|
Mark as:
• Currently Being Moderated
Sep 7, 2012 1:12 PM   in reply to LeeXiaoLoong

Since you mentioned in the original post that you had already created a cube out of solids, it is assumed you know how to create a solid layer...

﻿

Just choose Layer -> New -> Solid... or Right-click in the Timeline and choose New -> Solid...

In the dialog box set new solid width and height...

|
Mark as:
• Currently Being Moderated
Sep 7, 2012 1:58 PM   in reply to LeeXiaoLoong

Not sure I follow you...

You define a solid size while you're creating it. If you want to change a solid size afterwards, choose Layer -> Solid Settings... and enter new values (whatever you want) in the dialog box. You can't see a solid size as a property in the Timeline. However, you can operate them via expressions. E.g. the following expression for solid Scale will set it to 2000 x 2000 pixels:

[2000 / thisLayer.width * 100, 2000 / thisLayer.height * 100];

Rectangle Tool per se doesn't have any size.

If you want to create a solid of the same size as a rectangle on your shape layer, just change a solid size manually or write an expression.

﻿

|
Mark as:
• Currently Being Moderated
Sep 7, 2012 2:29 PM   in reply to LeeXiaoLoong

Not sure I follow you again...

You need to darken a solid edges. To do that you create a mask of the same size as a solid and use it as Path for Stroke effect. Stroke effect can't go outside a solid borders. You can see a Stroke effect both inside and outside mask borders in case it has lesser size than a solid...

|
Mark as:
• Currently Being Moderated
Sep 7, 2012 2:48 PM   in reply to LeeXiaoLoong

Stroke effect is normally visible at both side of a path.

In case above you're using a mask as a path for Stroke effect.

Since the mask has the same size as the solid, you can't see Stroke effect ouside the mask 'cos it can't exist in the Outer Space...

|
Mark as:
• Currently Being Moderated
Sep 7, 2012 3:14 PM   in reply to LeeXiaoLoong

It can in two cases:

- when the size of the Stroke path equals the size of the layer;

- when the Stroke effect uses a mask as a path (mask size is lesser than the layer size, and mask mode is set to anything apart from 'None') and Paint Style is set to Reveal Original Image. However, that literally means revealing original image under where the Stroke effect is applied, i.e. you won't see the rest of the object, and what you will see is a part of the object but not the Stroke applied...

|
Mark as:
• Currently Being Moderated
Sep 7, 2012 3:34 PM   in reply to LeeXiaoLoong

Whatever you want for your money.

Here is a solid painted green with two masks and the Stroke effect applied. Stroke effect Color is set to blue, Paint Style - to Reveal Original Image and Spacing - to 100%. Masks modes are set to Add and Subtract accordingly:

|
Mark as:
• Currently Being Moderated
Sep 7, 2012 3:44 PM   in reply to LeeXiaoLoong

Yes. Here is a part of the same layer under Stroke effect visible at both sides of the path (unless the path is within a layer), when masks modes are set to 'None':

|
Mark as:
• Currently Being Moderated
Sep 7, 2012 4:04 PM   in reply to LeeXiaoLoong

It does depend on what you actually want...

If you're talking on how to follow Rick's instructions for darkening solid's edges, then you need to set Path property of Stroke effect to mask and Color to similar to your solid one but a bit darker...

|
Mark as:
• Currently Being Moderated
Sep 7, 2012 4:47 PM   in reply to LeeXiaoLoong

Then just set Paint Style to Reveal Original Image.

It's similar to using Alpha channel as a Track Matte. But in this case the Matte for the solid is created out of Stroke effect (and masks accordingly). Here is two layers. The lower one is a pure solid layer painted blue. The upper one is the same layer with two masks and the Stroke effect from here (Stroke effect Spacing property is set to 100%):

|
Mark as:
Actions

#### More Like This

• Retrieving data ...

#### Answers + Points = Status

• 10 points awarded for Correct Answers
• 5 points awarded for Helpful Answers
• 10,000+ points
• 1,001-10,000 points
• 501-1,000 points
• 5-500 points