Ducks. Lots of Ducks.

Kids.  Work.  Life’s been crazy.  In a good way.  All that meant no posts for a while, but with the holidays upon us and a little more free time, I’m glad to be back to writing about Terragen 2.  The notes of thanks and encouragement about blog helped me find the time too.  Thank you!

So… placing a duck in a scene is nice, but what does that really get us?  Real life usually consists of much more than a barren landscape and a single object.  Flocks of ducks, forests, swarms of things look much more realistic and interesting.

Duck Population

Two populations of ducks

One option would be to rinse and repeat hundreds or thousands of times, adding objects one at a time to the scene.  Sound like fun?  No, I didn’t think so.  Fortunately Terragen 2 provides a feature called a Population that lets you place lots of a given object around your scene, and gives you plenty of control over how it’s done.

First, lets have a look at creating a whole mess of ducks then I’ll break down what’s happening:

You can download the project to more easily follow along with the rest of the blog.

With the project open, have a look at the Objects section.  Note that there are two populations of ducks in the same area, one with yellow ducks and one with… I’m going to say light-purple-pink ducks.

Highlight /Pop d2.obj.  This is the population description for one of the two duck populations.

The Distribution tab lets you define where the ducks will be added to the scene and how.  Area centre and Area rotation position and rotate whole area where the “flock” will be added, while Area length a and Area length b define the size of a rectangle that the flock will be fitted into.  Try changing some of the values and watch the preview window change accordingly.  You might want to reposition the camera a bit for a better view.

Did you try it out?  Seriously… give it a try.  You will learn much better by being hands-on.

Now have a look at Object spacing in a, b and Spacing variation in a, b.  These control how tightly packed the ducks are (if you’re doing a can of sardines, the object spacing would be a really small number, if you’re doing a very scattered population use large numbers… make sure your numbers are smaller than the Area length numbers if you expect to see many objects).  Spacing variation shakes things up a bit.  If set to zero, the population members would be lined up like ducks in a row.

In fact, try that out now.  Do this:

  1. Select /Pop d1.obj.
  2. Uncheck the Enabled checkbox (so you only see population 2 for now)
  3. Select /Pop d2.obj.
  4. Change Spacing variation in a,b to 0 and 0.
  5. Do a quick render and check out the result

My result looks like this:

Ducks In A Row

Ducks In A Row

The ducks are all turned a different direction (more on that in a minute, but they are spaced in a regular pattern).

One more option on the Distribution tab is to use a Density shader to mask the population we just defined.  Masking means it will remove some portions of the population based on the selected shader.  The documentation is not very clear on the exact criteria to mask/remove specific population members (hopefully a knowledgeable reader will enlighten me), but you can give it a try and see how it works by checking Use density shader and creating a new shader or assigning an existing one.  I used an existing one by hitting the green plus next to where you can enter a shader name, then selecting Assign shader / Fractal breakup 01.  Give it a try.

Let’s explore the other tabs on the Population object now.

The Terrain tab lets us pick which terrain to put the objects on the surface of.  In our case we only have Compute Terrain (in fact, that’s probably going to be the choice 99% of the time).

The Object scale tab allows for a range of scales for the population.  Try changing the Maximum scale from 1 to 3 and doing a quick render.  Might be funny with ducks, but with something like trees varying the scale from say 0.9 to 1.1 could make for a useful effect.

Remember how our Ducks in a Row were all lined up, but rotated all sorts of ways?  That’s because the Object rotation tab allows for a rotation anywhere from 0 to 360 degrees… so allows them to face any direction.  If you were creating a distribution of soldiers all moving in the same direction, you would want to give them a very narrow rotation range.  Here’s my version of that:

Duck Army

Duck Army

The last tab, Seed, lets you specify a number to start the random number generator used in creating the distribution.  All else being equal (same settings on all tabs), using the same seed will give you the same “random” results every time.

Object distributions present a powerful capability to create the realism of a complex world with little work.  Just a few object distributions overlaid on each other can create a detailed scene such as a forest in a matter of minutes.

This entry was posted in Objects. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s