AE ENHANCERS

Expressions/Scripts/Presets
It is currently Wed May 22, 2013 8:15 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Distribute layers in shape of sphere
PostPosted: Thu Feb 10, 2005 10:38 am 
Offline

Joined: Mon Jul 12, 2004 4:35 pm
Posts: 9
Location: Paris
This expression spreads layers in a 3D space to form a sphere. How does it do it? Simply by cutting a sphere in circular slices. These slices are, in my expression, the "rows". The "middle" slice is row 0, the slice above is row 1, and so forth.
As you can notice, apart from row 0, all the other rows are made of two slices.

Image

The sphere is symetrical to the place (x/z) containing row 0. My expression uses this symetry to facilitate the construction of the sphere.

Let's take a closer look :

The Null object "A" is in the middle of the sphere and is the parent of all the other layers. This allows to easily move and orient the sphere.

The value "a" allows to manage the space between two layers.

For the sphere to be perfectly homogeneous, this space has to be identical for all layers.
That is the first problem we encounter, because the radius of a slice depends on its row. Thus the spacing angle too.
The image below illustrates this problem : we want the AB distance to be equal to the A'B' distance.

Image

The radius of the "middle" slice (row 0) is d, the radius of the sphere.
But the radius of the i slice (row i) is d*cos(a*i).
So we obtain the following equation :
Code:
d*a=d*cos(a*i)*x

Where x is the spacing angle to row i.

So we get :
Code:
x=a/cos(a*i)


The second difficulty is the amount of layers per slice. The answer is simple, it is
Code:
2*Math.PI/spacing angle

For it to always be an integer, I added the Math.round function :
Code:
s=Math.round(2*Math.PI/(a/Math.cos(a*i)))

From there one has to adjust the spacing angle for each row, which becomes :
Code:
u=2*Math.PI/s


The symetry is obtained with the function Math.pow, Math.floor is the number of the layer : index-2 or n (n is the number of the layer, the first layer of the sphere is number 1...etc).
Here are the two lnes of code that create this symetry :
Code:
symétrie : y=u*Math.floor((index-2)/2)

and
Code:
d*Math.sin(a*rang)*Math.pow(-1,index-2)


I hope this helped

Thanks


You can download the project:
http://oscarvideo.free.fr/sphereoscarus.zip


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 16, 2005 9:43 am 
Offline

Joined: Wed Jul 07, 2004 2:30 pm
Posts: 319
Location: Charlotte, NC
I just had a chance to check out your project.

That is awesome!

_________________
Byron Nash
CG/VFX Generalist
http://www.editatjoes.com
http://www.armoredsquirrel.com


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 16, 2005 11:24 am 
Offline

Joined: Mon Jul 12, 2004 4:35 pm
Posts: 9
Location: Paris
thank you byronnash!

Oscarus.


Top
 Profile  
 
 Post subject: Congratulations !
PostPosted: Tue May 17, 2005 8:41 am 
Offline

Joined: Sat May 14, 2005 9:57 am
Posts: 5
Location: paris
This project give more power than the 3D layers assistants (in the case of a sphere of course) because you can animate all your layers all together..
Just amazing. Oscarus rocks and rules !

I give this script 5 smiles :
:lol: :lol: :lol: :lol: :lol:


UPDATE :
When moving the "angle"'s "curseur" to O or less, AE is freaking out, forcing me to quite the software.


Top
 Profile  
 
 Post subject: Re: Distribute layers in shape of sphere
PostPosted: Wed Oct 01, 2008 2:23 am 
Offline
User avatar

Joined: Wed Jun 16, 2004 4:04 am
Posts: 1
Hi all!
great technique!
Quite dated thread, so I though to revamp it with my ignorance...

I downloaded the aep, and replaced the 47 blue layers with 47 other square ones, and pasted the expressions. After a take or two it worked without error warning, but the layers intersect, no matter how I adjust the sliders of the null.
the original layer size is 800x800 scaled to 576.
Is there any adjustment I need to do in order to get it right?
(using cs3)
Thanks in advance,
Evan


Top
 Profile  
 
 Post subject: Re: Distribute layers in shape of sphere
PostPosted: Mon May 31, 2010 11:40 am 
Offline

Joined: Mon Jul 12, 2004 4:35 pm
Posts: 9
Location: Paris
Hello, I just realized a tutorial video with projet.aep showing how to create and animate a sphere with expression in After effects :sphere.flv

Oscarus
--------------------------------------------------------------------------
site: http://oscarvideo.free.fr
email: oscarvideo@free.fr
--------------------------------------------------------------------------


Top
 Profile  
 
 Post subject: Re: Distribute layers in shape of sphere
PostPosted: Mon Apr 02, 2012 10:33 am 
Offline

Joined: Thu Mar 29, 2012 4:48 pm
Posts: 1
oscarus wrote:
Hello, I just realized a tutorial video with projet.aep showing how to create and animate a sphere with expression in After effects :sphere.flv

Oscarus
--------------------------------------------------------------------------
site: http://oscarvideo.free.fr
email: oscarvideo@free.fr
--------------------------------------------------------------------------


Looks really interesting, but I can't seem to find the English version. Any ideas?

John

_________________
Land For Sale


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group