Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Parallax Scale with Null Object?

New Here ,
Jul 10, 2018 Jul 10, 2018

Hello,

I have a set of 2d layers and would like to do a parallax scale with them using a null object and an expression. I have all my layers parented to a null object, but I can't figure out an expression that works. I want to scale up the null object, and then the layers scale differently based on a value variable. For example, mountains in the background will scale much slower than the bushes in the foreground, but this both happens while scaling one null object. Any suggestions? Thanks!

-Kyle Carr

3.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jul 10, 2018 Jul 10, 2018

Would it be easier if the layers were converted to 3d layers (and set at the correct x,y,z position and initial scale).

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 10, 2018 Jul 10, 2018

I'll play around with that. I have a false 3d landscape in a 2d composition and wanted to create a false parallax, but maybe changing the layers to 3d and working with z space will be easier. I'll play around with it.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 10, 2018 Jul 10, 2018

Working in 3D will give you heaps more control and accuracy, and added benefits like the ability to add lighting and depth of field.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 16, 2019 Oct 16, 2019
Is there a solution to do this with some expressions on scale? I have a situation that doesn't suit 3d layers, z pushes etc.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 16, 2019 Oct 16, 2019

I actually figured this out. It's useful in my case base the parallax is phyiscally fake...everything needs to connect to the same horizon line but still scale up as if parallaxing.  This only works as a "zoom" but that's all I need for this case. 

 

There are 4 nulls in the in the same position.  Each one needs to scale up slightly less than the parent.  This may not be plug and play or self-explanatory but the logic is there (maybe a little convoluted).  Any questions let me know.

 

a = thisComp.layer("PARENT").effect("PARENTSCALE")("Slider")
b = thisComp.layer("PARENT").effect("RATIO_1")("Slider")

y = (1+a)*100;

z = (1+(a/b))*100;

x = (y/z)*100;

temp = x;
[temp, temp, temp]

 

Controller: Keyframe is a fraction but its added back to 1 in the expression then multiplied by 100.  To get the parallax effect, the keyframe action is divided by another fraction "RATIO_01" 

 

keyframe1.PNGexpand image  keyframe2.PNGexpand image

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 16, 2019 Oct 16, 2019
LATEST

Here's the problem when working with all 2D layers. "Scale" is linear, "parallax" is exponential. That's why there is an Exponential scale tool in AE. 

 

Theoretically, you could write an expression that would multiply or divide the scale of the null by a factor calculated by the relative distance you want to assign to each layer. You are really getting into the weeds here.

 

A much easier approach is to apply an expression to a 3D null that adjusts the scale of a layer based on the comp center and the distance from the camera. As the 3D null moves farther away from the camera the scale is adjusted to keep the null (layer) at an effective 100% scale. Now all you have to do is hold down the shift key and parent your background layer to the null, then move the null to where you want the background to be in Z space. When the background layer is where it should be, release the parent, Shift + parent the middle-ground layer to the null and move the null into place so the background layer and foreground layer are properly positioned. Then repeat the procedure for the foreground layer. It only takes a couple of minutes to arrange the layers and get them to line up so you can do a camera move if you use 4 views so you can see what is going on in the Active Camera, Top View, Front View, and I like Custom View 1 or Left for the fourth window. Until you move the camera the comp will look like it is all 2D layers properly lined up. Move the camera and parallax happens automatically and perfectly.

 

Here's the expression for the 3D null's scale property:

 

C = thisComp.activeCamera;
CP = fromWorld(C.toWorld([0,0,0]));
L = thisLayer
LP = fromWorld(L.toWorld(anchorPoint));
d = length(CP, LP);
z = C.zoom;
r = d/z
r * value

 

This is what a comp looks like when it is all set up:

Screenshot_2019-10-16 15.11.24_uNLgNJ.pngexpand image

Including the masking for the 3 different layers with the girls and the cloning to fill the background, this took about 5 minutes. 

 

Save that expression as an animation preset. I use it at least two or three times a month and have for a very long time. 

 

Here's the AEP: https://www.dropbox.com/s/041s5l9409i97dz/sinmple%20fake%203d.aep?dl=0

 

Just replace the missing JPEG with one of your own, redo the masks and the cloning, and you'll see what I mean. 

(note: if your browser adds a .txt extension to the AEP just delete it)

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines