Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Splitting and Distributing Layers in 3D space Via Slider Randomly

  • Splitting and Distributing Layers in 3D space Via Slider Randomly

    Posted by Victor Nash on August 4, 2015 at 2:08 pm

    I have a really cool expression that creates the illusion that an image looks normal based on the camera position.. but once the Camera rotates and moves, you can see all the layers are distributed randomly in 3D Space. The Expression adjusts the Scale of each layer to make it appear normal size based on the Camera’s Position. I create an Expression slider for each layer and set the parameter to 100. Smaller than 100 moves towards the Camera, less than 100 moves away from the Camera.. (Expressions Below)

    My Question:
    Instead of adjusting a random position for each one (which could be hundreds).. is there are way to attach each layers expression slider to one main Expression Slider that feeds a Random Distribution for each layer. My goal is to quickly readjust the Z distribution if its not quite right.

    1. Created an Expression Slider on each Layer and called it zControl and set the initial value to 100

    2. Pasted this on Position Value on each layer: (Z space based on Camera's Position when created)

    cameraPos = [thisComp.width/2,thisComp.height/2,-1866.6667];
    zControl = effect("zControl")("Slider")
    v = (value - cameraPos)*zControl/100 + cameraPos;

    3. Pasted on Scale:

    zControl = effect("zControl")("Slider")
    value*zControl/100

    Victor Nash replied 10 years, 9 months ago 1 Member · 1 Reply
  • 1 Reply
  • Victor Nash

    August 4, 2015 at 2:22 pm

    To Follow Up.. I’d love to Cap the Values to Randomize within (-20 and 180). Something like this:

    seedRandom(index,true);
    zVal = thisLayer.transform.position[2]+random(-20, 180);
    [zVal]

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy