38 Replies Latest reply on Sep 8, 2012 3:46 PM by LeeXiaoLoong

# How to make a perfect cube

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:

• ###### 1. Re: How to make a perfect cube

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.

• ###### 2. Re: How to make a perfect cube

this point is easy, you can do it just using the anchor point editor

BUT

in 3d layer the Z anchor point if set to 0 is in contact with the layer so if i rotate it, the layer will rotate on it

in this video you can see how modifying the Z value and rotate the layer on the Z layer you can create a cube without any headache, BUT this video is made with NEW - SOLID i want to make it with a rectangle tool and with rectangle tool i don't know what value ive to put inside the Z anchor point

i hope you understand what i mean

if i want to make the anchor point centered in the ipotetic cube i have to measure the layer ive created then divide it by 2 and set that number as anchor point U_U bit long to do, there sn't an info tool that tell you how much larget is a layer? cause with rectangle tool you create it without a size, you just create it from nothing, in the righ-up corner there isn't write the size of the layer like 300x300 etc

• ###### 3. Re: How to make a perfect cube

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.

• ###### 4. Re: How to make a perfect cube

can you screen some example? i really don't get how i can... it's a bit hard to understand a guide in english while im italian then translate everything from english to italian and apply it to the program U_U

btw ive set shape anchor and position as your image, butlook the video, look the Z anchor point, how can i set it if i don't know in example the size of my layer? that Z point will be the solution of all, if i can set it properly without calculate everytime the size of the layer manually (by moving the mouse slowly on the side to know how much pixel is larger/higher) i will solve everything

• ###### 5. Re: How to make a perfect cube

Red Arrow indicates the shape Contents Anchor Point.

Green Arrow points to the rectangle size.

Blue Arrow indicates the layer Anchor Point.

• ###### 6. Re: How to make a perfect cube

okok got it, with the size i can divide it by 2 and set the result number as anchor point in Z coordinate so with that anchor point i just need to set 90 degree on left/right panel, 180 on back and on X i set 90 and -90 and i got the cube

this is what i need

thanks man XD sorry for waste of time U_U

about Z anchor point (not rotation) right near the blue arrow, is there a tool that can set the anchor point in example if i have 300x300 square, the anchor point in an ipotetical cube is 150 to be in the perfect center, is there a tool that can set this anchor point to 150 without a manual setting?

i hope you get my point...

• ###### 7. Re: How to make a perfect cube

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.

• ###### 8. Re: How to make a perfect cube

O.o WTH where did you learn this expression? is there a guide where i can learn them?

very useful thank you

• ###### 9. Re: How to make a perfect cube

You can start from the Expression basics help section.

• ###### 10. Re: How to make a perfect cube

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

• ###### 11. Re: How to make a perfect cube

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.

• ###### 12. Re: How to make a perfect cube

yeah i knwo this method, and i found a solution to make a cube made of text too, using the alpha mask to use text instead of rectangle layer, so technically with alpha mask you can make cube with everything

thanks for you message

• ###### 13. Re: How to make a perfect cube

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

• ###### 14. Re: How to make a perfect cube

what is supposed to do STROKE?

• ###### 15. Re: How to make a perfect cube

i don't get the point of double click the rectangle tool...

i create with rectangle tool a layer (with the star near the layer) then i select it in the timeline and click 2 time the rectangle tool, well after effects create me another rectangle that is the same size of composition... what im doing wrong?

and how you have a cube with layers without star so how you made the cube without rectangle tool?

• ###### 16. Re: How to make a perfect cube

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.

• ###### 17. Re: How to make a perfect cube

and rick how create a cube without rectangle tool? i have stars near the layer so it's the rectangle tool, rick how create that cube with SOLID layer? a simply guide to make a cube like that but with solid? this is a point that i really don't get

• ###### 18. Re: How to make a perfect cube

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...

• ###### 19. Re: How to make a perfect cube

yes yes sorry i forgot to add: solid that has the same size of the rectangle tool, it's enough copying just the high and wide value from rectangle tool?

sometimes i lose myself in a cup of water -.-

• ###### 20. Re: How to make a perfect cube

when i use stroke on the mast, the stroke is applied on both side, how can i apply stroke on a single side of a layer?

• ###### 21. Re: How to make a perfect cube

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.

• ###### 22. Re: How to make a perfect cube

okok got it, what about stroke? can i apply it on one side of the layer? or can i make it go outside the mask? if i create a mask manually i can make the stroke exit from the mask going outside, with the stroke effect i can't, anyway is there a way to make the stroke appear only on one side of the figure? and eventually make the stroke effect outside the mask and not just inside?

• ###### 23. Re: How to make a perfect cube

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...

• ###### 24. Re: How to make a perfect cube

what you meen for size of stroke? i want to see it on a single side, how i can do this?

anyway ok stroke can just stay inside of mask, but is there a way to make it appear outside the mask, think about a random figure, like hummm a balloon, if i want to make stroke appear outside the mask aorund the balloon how can i make it?

• ###### 25. Re: How to make a perfect cube

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...

• ###### 26. Re: How to make a perfect cube

so it cant be visible to only one side? U_U

• ###### 27. Re: How to make a perfect cube

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...

• ###### 28. Re: How to make a perfect cube

ehm... what? XDDDDD

can you post an image or few image that will guide me through thid hard road to make stroke effect visible only on one side?

• ###### 29. Re: How to make a perfect cube

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:

• ###### 30. Re: How to make a perfect cube

this will make stroke appear on one side only?

• ###### 31. Re: How to make a perfect cube

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':

• ###### 32. Re: How to make a perfect cube

so in order what i have to do? make a mask around the square, apply stroke, then?

• ###### 33. Re: How to make a perfect cube

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...

• ###### 34. Re: How to make a perfect cube

I want to make stroke affect just one side of the layer not both

• ###### 35. Re: How to make a perfect cube

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%):

• ###### 36. Re: How to make a perfect cube

wth uff, can't achieve the result i want...

a super program that can't decide to put effect on just one side -.-

• ###### 37. Re: How to make a perfect cube

as you can see i can achieve my objective duplicating the layer and make one of them the Z anchor point to 0,001 so it will cover one side of the figure

but seeems so strange that i can't do this with just one layer...

• ###### 38. Re: How to make a perfect cube

a little up, look the image i posted, is possible to do that WITHOUT use 2 layer while one of them has the Z anchor point set to 0,001 to cover one side of the figure and let the stroke be visible only on one side?