Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions How do I control a grid of squares in 3d height with one Null

  • How do I control a grid of squares in 3d height with one Null

    Posted by Pieter Van dijken on September 18, 2009 at 8:48 am

    Hello,

    I want to create this :
    https://www.youtube.com/watch?v=H0-EiXerCkc

    Squares that go up or down as if they’re a mountain.
    And i wonder if this can be done, using one Null that pulls the squares up or down from a fixed position.

    Meaning the Null acts as a control for the square grid.
    No matter what direction you pull, the grid reacts.
    So not linear on one axis.

    Hope someone has an idea. In that case thanks.

    Some contents or functionalities here are not available due to your cookie preferences!

    This happens because the functionality/content marked as “Google Youtube” uses cookies that you choosed to keep disabled. In order to view this content or use this functionality, please enable cookies: click here to open your cookie preferences.

    Filip Vandueren replied 16 years, 8 months ago 3 Members · 2 Replies
  • 2 Replies
  • Xinlai Ni

    September 18, 2009 at 2:44 pm

    I’m not sure how you can control all the squares with one null object going up or down, there certainly are randomness in the heights of squares and the heights seen as a function of x-y plane is continuous, i.e., can’t be totally random.

    Not that I have tried this, but I can imagine one to attack this problem from the following directions:
    – generate a fractal noise “cloud” layer, which acts as a continuous height map (white = high, black = low)
    – use script to iterate through all the small square layers, and set its position[2] (assuming z is is the height dimension) to be proportional to cloudLayer.sampleImage(squarePos…)
    so where cloud layer has whiter pixel, the square is positioned higher.
    – use a null or simple expression to control the evolution of clouds.

    The above doesn’t give you much control to where you have bumps and where you have troughs.
    Another idea would be to have a few null objects roaming around on the x-y plane, with their z changing continuously, each null contributes to every square’s height displacement by how far the square is from the null, something like:
    for (j = 1; j <= numSquares; ++j) { squareDisplacement = 0; for (i = 1; i <= numNullLayers; ++i) { squarePos = [squareLayer[j].position[0], squareLayer[j].position[1]]; nullPos = [nullLayer[i].position[0], nullLayer.position[1]]; distFromNull = (squarePos - nullPos).length; squareDisplacement += 10 / length; } } This essentially raises the square if it's near a null, but falls continuously as it's farther away from a null, and you have controls over the heights of nulls. Xinlai Ni

  • Filip Vandueren

    September 19, 2009 at 9:53 am

    No need to use sampleimage on a cloud layer… The noise() function does this for you.

    There’s a tutorial article by Dan on the Cow called something like “hidden gems: noise”
    if describes 90% of what you want. Just multiply the results by a slider going from 0 to 1 and you have your rising and falling mountains

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