Animated tree population dilemma

Started by rolland1013, May 18, 2023, 06:52:51 PM

Previous topic - Next topic


I've got a animation challenge I don't know how to tackle. Recently, we've been using Terragen in a television series we do work on. It's mostly landscapes of forest trees. Now that the project has wrapped for the season, we'd like to add some of these shots to our demo reel. For a couple of them we want to show a breakdown of how they were created. For the trees, we want them to wipe on in a creative way. We'd like them to drop in, or grow in place. The wipe part is easy. I was going to use an animated matte to reveal the area for the population. But I can't figure out how I would animate the trees dropping in or growing. I figured I would start with an obj sequence of a (Speedtree) tree animating down or growing. After that I'm stuck. How do I get the animation of each tree instance to begin as it is revealed?

Any suggestions would be greatly appreciated. 

Thanks, Niel 

Kevin Kipper

Hi Niel,

Great question.  The only way I think you could attempt this is to duplicate the population, and change the Frame offset parameter for the 3D object sequence assigned to the population's Object Maker.

You would need to duplicate the population as many times as you think are necessary for the reveal wipe to make a smooth transition, and disable the Loop checkbox too.


Thanks for your response Kevin! I'd have to change my original idea of individual trees dropping to clumps of trees dropping. But it could work. 
Another related question: Instead of using Terragen to do this gag. I was thinking Maya might be a quicker solution. My question is, can I extract the population instance data in a format that Maya could understand?


Kevin Kipper

Hi Neil,

I thought of that over the weekend, but didn't have a chance to test it.

Yes, you can export the population cache in POPXML format.  Here's a snippet of what the data looks like:

<instances version = "2" numInstances = "598" >
<instance id = "2" variant = "0" matrix = "0.958288 0 0.285803 -464.659 0 1 0 0.0101661 -0.285803 0 0.958288 -493.402 0 0 0 1" />
<instance id = "3" variant = "0" matrix = "0.28706 0 -0.957913 -412.313 0 1 0 -0.130087 0.957913 0 0.28706 -486.485 0 0 0 1" />
<instance id = "4" variant = "0" matrix = "0.815718 0 -0.57845 -378.421 0 1 0 -0.160379 0.57845 0 0.815718 -498.78 0 0 0 1" />
<instance id = "5" variant = "0" matrix = "0.97245 0 -0.233111 -353.674 0 1 0 -0.149737 0.233111 0 0.97245 -484.127 0 0 0 1" />


Great! Thanks again, Kevin!

Could you explain all the values? I looked in the online documentation, but couldn't find anything.

Kevin Kipper

Hi Neil,

I'll work at updating the online documentation to reflect an accurate explanation of the POPXML format we're using.

In the meantime here's a very simplified explanation, and I would further recommend researching the use of "4 x 4 matrices in computer graphics" (which is what I've been doing!).

In the POPXML file, each instance's position, rotation and scale data is stored on a line in a 4 x 4 matrix. 

In the example used above, the matrix for instance id #2 would like like this:

0.958288 0 0.285803 -4646.659
0 1 0 1.0101661
-0.285803 0 0.958288 -493.402
0 0 0 1

The XYZ coordinates of instance #2 is (-4646.659, 1.0101661, -493.402) which corresponds to the values in 4th column in the first 3 rows.

The XYZ Scale information for the instance comes from the first value in the first row, the second value in the second row, and the third value in the third row, however; these values can also be affected by rotation values.  For example, note how the first value in the first row and the third value in the third row are the same value of 0.958288, but the second value in the second row is 1. 

Explaining how the Rotational values are calculated is a bit above my pay-grade at the moment, but here are some good links that I've found helpful so far.

Spatial Transformation Matrices

Youtube video on Matrix Basics

If there are any math-wizards out there, please feel free to elaborate on the use of matrices!