7 Replies Latest reply on Oct 18, 2011 2:59 PM by Zwelly

# Problem CC Sphere in 3D comp with Camera Mouvement

Ok, i'm in a composition with layers spread in z-space.

I've got a rounded aquarium, semi transparent, and i want the layers behind it to be deformed as if the aquarium was an actual sphere.

So i've setup an adjustement layer with a CC sphere effect on it, put the adjustement layer in 3D space just behind the aquarium layer.

Now i've got every layer behind the aquarium deformed, and it works exactly as expected. But...

if i move the camera everything become messy. The CC-Sphere stays at the same since as if it was not on a 3D layer. It always stays attached to it's offset point, even when i rotate the camera.

I've been looking at expressions but i'm not that good when linking 2D to 3D values with a camera. The camera does a really subtle truck-in with really light wiggle on it's rotation paramters, just to add a little life into the scenery.

Any ideas guys (and gals ) ?

• ###### 1. Re: Problem CC Sphere in 3D comp with Camera Mouvement

Good old toComp() ?!. Create a 3D layer (Null) as a dummy for the center of the sphere, then use this:

s3D=thisComp.layer("Null");

s2D=s3D.toComp(s3D.anchorPoint)

Mylenium

• ###### 2. Re: Problem CC Sphere in 3D comp with Camera Mouvement

I'm bringing this back because I have the smae issue and that expression doesn't seem to do the trick. Anyone else have any ideas?

• ###### 3. Re: Problem CC Sphere in 3D comp with Camera Mouvement

It's a little more complicated than a single expression. You have to tie the X and Y rotation to the camera position, then if you want to mimic a light in the composition you have to tie the light height and light direction to the light position.

A quick Google search for "attach camera to cc sphere" brings up this set of expressions from AE Enhancers. Interestingly enough the same page is listed in the AE Help files under Tips and online resources for moving and animating cameras and lights as a tip from Rich Young.

I've got another version, using the same technique but a little different language. These expressions should solve your problems as written without any need to rename layers from their default names.

• ###### 4. Re: Problem CC Sphere in 3D comp with Camera Mouvement

Maybe i'll try to describe my situation a little more.

I have a CC sphere and a camera. I'm trying to make the camera fly into the sphere. but when I move the camera in, the ccshpere stays put. (no lights)

Thanks

• ###### 5. Re: Problem CC Sphere in 3D comp with Camera Mouvement

I just did it and it worked.

Create comp.

create new Layer / Solid

Assign CC Sphere to that layer

** Turn on 3D switch for that layer **

Add Camera and zoom in. Sphere grows in size. Im not sure what the significance of "no lights " is.

• ###### 6. Re: Problem CC Sphere in 3D comp with Camera Mouvement

To change the radius based on the camera position you need to add the expressions in my previous post to X and Y rotation then you need to calculate the distance between the camera and the sphere. The sphere is always going to be at a world Z value of 0 because it's a 2D layer so it's faking the z location.

To measure the distance between the camera and the you use the length(value1, value2). To set up a variable ratio you divide the distance by the zoom value +1 (to avoid a divide by zero error). The expression is then added to the radius property.

Here's what it looks like:

```c =thisComp.activeCamera.toWorld([0,0,0]);
d = length(c, position);
z = thisComp.activeCamera.zoom;

newR = value * z/(d+1)
```

That's about all there is to it. If you want to fly past a planet or move it off center just turn the planet layer into a 3D layer. The math is close, but not perfect. I've never needed a project that required perfect.

• ###### 7. Re: Problem CC Sphere in 3D comp with Camera Mouvement

Awesome! Works great, thank you.