Contents
Random Scattering: Creating Realistic Landscapes
 
 
Printer-Friendly VersionPrinter-Friendly Version
 


Part of:



[More information...]
 

Latest News
spacer View All spacer
 
November 22, 2009
 
Video Game Watchdog National Institute On Media And The Family Shutting Down [11]
 
Modern Warfare 2 Infinity Ward's 'Most Successful PC Version' Yet [12]
 
New Tech, Design Details Of Project Natal To Emerge At Gamefest In February
spacer
Latest Jobs
spacer View All     Post a Job     RSS spacer
 
November 22, 2009
 
Trion Redwood City
Sr. Evnironment Modeler
 
Trion Redwood City
Sr. Environment Artist
 
Sucker Punch Productions
3D Environment Artist
 
Sucker Punch Productions
Network Programmer
 
Sucker Punch Productions
Character Artist
 
Sucker Punch Productions
Texture Artist
 
Monolith Productions
Sr. Software Engineer, Engine - Monolith Productions - #113767
 
Sony Online Entertainment
Brand Manager
spacer
Latest Features
spacer View All spacer
 
November 22, 2009
 
arrow Upping The Craft: Susan O'Connor On Games Writing [6]
 
arrow Small Developers: Minimizing Risks in Large Productions - Part II [7]
 
arrow iPhone Piracy: The Inside Story [48]
 
arrow And Yet It Grows: Analyzing the Size and Growth of the European Game Market [5]
 
arrow NPD: Behind the Numbers, October 2009 [13]
 
arrow Reflecting On Uncharted 2: How They Did It [5]
 
arrow Sponsored Feature: Rasterization on Larrabee -- Adaptive Rasterization Helps Boost Efficiency
 
arrow Postmortem: Wadjet Eye's The Blackwell Convergence [2]
spacer
Latest Blogs
spacer View All     Post     RSS spacer
 
November 22, 2009
 
Time Fcuk [1]
 
Accepting the Inherent Value of Games
 
Planckogenesis, Part II: Song Structure & Gravy Train [1]
spacer
About
spacer News Director:
Leigh Alexander
Features Director:
Christian Nutt
Editor At Large:
Chris Remo
Advertising:
John 'Malik' Watson
Recruitment/Education:
Gina Gross
 
Features
  Random Scattering: Creating Realistic Landscapes
by Mick West
5 comments
Share RSS
 
 
August 6, 2008 Article Start Previous Page 3 of 3
 

Mass-Spring Scattering

A common method in the literature of distributing objects in a non-overlapping manner is to essentially connect each object to its neighbors by a spring and then "relax" the positions of the objects so that the springs take care of the constraints and the factors influencing distance.

Figures 4 through 6 show this process:


Figure 4: The spring mass system is shown here in its initial state. Each tree is connected to its neighbors by springs of random rest length.


Figure 5: The spring mass system is shown after running 40 iterations.


Figure 6: The tree distribution pattern from the spring mass system is shown with the springs removed.

First in Figure 4, the trees are arranged in a regular grid with springs between them. Each spring has the same initial length (different for diagonals), but has a random rest length. The spring mass system is then iterated several times (40 times in this example; see Figure 5); we then remove the springs, leaving the trees in their final positions (Figure 6).

The relaxing method has a number of problems. For one, it's a more complex method to implement. Second, it requires tweaking to get good looking results. Third, there are problems at the boundaries of the area we are trying to cover.

Because the spring mass system's rest state is unlikely to be similar to the start state, the boundaries of the system end up either shrinking inward or expanding outward, unless the system wraps or additional constrains are added.

Different Sized Trees

So far, we've been trying to evenly scatter a bunch of identically sized objects. What if we want to have objects of differing sizes, with differing growth inhibit zones? The mass-spring system is not so suitable for this task, as it's not trivial to get an initial regularly spaced configuration (although it can be done).

Instead, we could change to a particle system in which each object repels every other object according to some function of distance that is in keeping with their mutual zones of exclusion-and an additional constraint is applied to keep them all together. This is obviously an expensive operation, as it requires multiple iterations of O(n2).

Alternatively, we can go back to the random scattering method where we simply move the object to a new and random position if it gets too close to any other object. This approach requires essentially a single iteration of O(n2), since there are generally very few collisions.

It can also be optimized much closer to O(n) by using buckets for proximity, as mentioned earlier. Figure 7 shows the results of such an algorithm.


Figure 7: Random scattering is shown here with proximity constraints for four different sized objects.

Of all these methods, only the random perturbation is trivially amenable to reproducible procedural landscape generation in arbitrarily small amounts. Since the other methods need to generate a specific number of trees at once, you would need to fill an entire segment of the environment.

To avoid visible boundaries between regions of trees, these segments should conform to natural boundaries within the environment, such as rivers or roads. Since simple positions are not very memory intensive, this method works well for large segments. It's also an ideal process to put on a low priority thread as part of a "procedural spooling" system (see "Procedural Spooling," Game Developer, February 2007).

The Forest, The Trees

Random scattering in nature is not really random. A complex set of underlying rules governs the pattern, even if humans can only see the results as random; however, an image of pure mathematical randomness doesn't look "natural" at all.

Sometimes simple solutions work out better than complicated ones. In this case, to scatter a forest of trees, we found that applying a very simple exclusion zone around plants achieved a nice random distribution of different sized plants.

For most situations, this is reasonably quick and compares well to more complex solutions that involve relaxing spring systems.

[EDITOR'S NOTE: This article was independently published by Gamasutra's editors, since it was deemed of value to the community. Its publishing has been made possible by Intel, as a platform and vendor-agnostic part of Intel's Visual Computing microsite.]

 
Article Start Previous Page 3 of 3
 
Comments

Sebastian Bender
profile image
Interesting article especially for novice programmers since it shows nicely that complex phenomena can be coded with rather simple solutions.

Anonymous
profile image
As an artist, this just cracks me up. Looks like good tech for stub-art. Trees aren't random in any sense. The factors that put a tree in place are diverse and an artistic eye is needed to discern what makes sense and what doesn't. Trees don't grow out of rocks, trees don't grow under the shade of other trees, trees will cluster in the lower elevation ruts and water-paths along hills and mountains, not the high points...unless the dirt/rocks/angle of that particular mountain make those areas land-slide-prone. Trees will cluster along fence-lines because the saplings will get cut down by mowers or eaten by animals on one side of the fence. Trees cluster around rivers, then don't grow much at all around huge flat planes in some cases. There's so many variables that are biological that should be taken into account instead.

But if one is making an MMO and the artists don't have the time or the ability to think through that kind of thing and they need a LOT of trees in a hurry, this tech might help as a substitute for their better judgement and precious time.

David Delanty
profile image
Pretty cool insight there, Mick. I like how you emphasize the fact that there is a lot of "organization" required to make an effective "random" output. You can't just throw darts blindly at a board, the effect of random needs to be organized in such a way that it still follows a sort of order.

While I do agree with above comment that the analogy of trees does require a bit more detailing than what's in the article, and that you could probably write an entire novel on the physics of tree placement, it's the *principle* of making randomized placement of objects that I know you're going for, and it's very well explained.

Patrick Coan
profile image
There really is no such thing as "random" in my opinion, only behavior which is beyond our comprehension. So when considering a forest, all of the Anonymously mentioned factors will apply, but so does this method which Mick describes.

The described distribution model should only be used as a tool for initial plotting, if the target result is something of cinematic aesthetics. After the samples are placed, let the artists carefully move things around until the illusion is created. If you are flying a jet through the mountains, then I don't think that anyone cares about the trees along the fence.

Aaron Casillas
profile image
Anonymous is correct. Trees in nature follow two simple heuristics, follow the water and stay near mom.

If you look closely, they emerge in and out of valleys more than other areas.

Second, saplings will always be found near their parent tree. This pattern repeats over and over again.


none
 
Comment:
 


Submit Comment