Generating Complex Terrains for Unity3D

Post on 09-May-2015

23.073 views 0 download

description

Visit the original blog post at http://fragileearthstudios.com/2012/09/15/generating-complex-terrains/ for additional information and sample files. Forget what you know about editing terrains. Unlike the terrain editor in Unity that functions like a paint program, World Machine (and programs like it) operate on a procedural level. A World Machine world file is not the terrain, but the steps that creates the terrain. This is the source of both its power and its complexity. This presentation covers the process on how to use World Machine in conjunction with Unity3D to generate realistic looking terrains for your scene.

Transcript of Generating Complex Terrains for Unity3D

Terrain by Vincent Ferrand

Generating Complex Terrains for Unity3DEric Hackathorn

9/10/2012

Preparation

You should be done with

this!

Download material from the classroom web site

The World Machine Device

Inputs

Outputs

Program Variables

Input Mask

World Machine operates on a procedural level. A World Machine world file is not the terrain, but the steps that creates the terrain.

http://world-machine.com/learn.php

Overall Device Structure

Terrain Generation Overview

Perlin

Perlin Noise works by layering the output of several sets of noise together. These layers are called octaves. The multiple octaves are combined together in a variety of ways to create the final result.

Radial Gradient

The Radial Gradient generator creates shapes that are all centered around one point in space. (Ex: spherical, gaussian, diamond, square, cone.)

Combiner

The combiner combines two separate terrains into one. There are a variety of different methods that can be used to combine the terrains -- each will give a different effect.

Layout

A layout generator interacts with the layout view to provide a home for a set of shapes you can use to define terrain shapes, create masks, add roads, and more.

Erosion

The erosion filter simulates the work of thousands or millions of years of weathering and erosion by rain, flowing water and mass movement. It is an exceptionally useful tool to add detail and realism to human-created terrains. There are a large number of parameters in the Erosion device and each parameter can interact with the others to create to a unique effect.

Terrain Height Map

Bitmap Generation Overview

Select Slope

The slope selector is used to create a mask that highlights areas of the terrain that have a particular slope. The output will be full strength (white) in those sloped areas and zero strength (black) outside of it.

Select Convexity

The convexity selector discovers areas of the input terrain that are either highly exposed (convex) or recessed (concave). Convex areas are white (one), while concave areas are black (zero). Neutral areas that are neither will be neutral grey. This device can be very useful for texturing to either to help shadow recessed cracks in the terrain, or to bring out ridges and other areas that are highly exposed.

Select Height

The height selector is used to create a mask that highlights a certain height range of the input terrain. The output will be full strength (white) in that range area and zero strength (black) outside of it.

Probability Filter

The probability filter treats the input map as a probability density function, and creates a mask that randomly scatters dots according to that density function. It is intended to be useful for object placement maps.

Channel Combiner

The channel combiner recombines three individual height fields into a bitmap typically using the red, blue, and green channels.

Terrain Distribution MapsSplat Map

Grass Distribution

Tree Distribution

Output File Overview

File Types

The file output device saves the fully built height field to disk. Only the height field information is saved -- any color-height mapping applied in World Machine is for illustration only, and is lost.

The bitmap output allows you to export a bitmap data type to a file. You may export to either 8 or 16bit per channel color formats.

Import into UnityHeight Map Splat Map Grass Map Tree Map

One small last part…

Height Map

Scene Setup

The terrain paint tool is expecting four textures for the R, G, B, and Alpha channels of the splat map.

The tree placement tool is expecting three prefabs for the R, G, and B channels of the tree distribution map.

The grass and detail placement tool is expecting six grass or detail meshes for the R, G, and B channels of the grass distribution maps.

Terrain Script

Drag the appropriate textures into the splat map, tree distribution, and grass/detail distribution settings in “Julien’s Terrain Tools” and hit apply.

Questions?Eric Hackathorneric@fragileearthstudios.com