Generating Complex Terrains for Unity3D

25
Terrain by Vincent Ferrand Generating Complex Terrains for Unity3D Eric Hackathorn 9/10/2012

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

Page 1: Generating Complex Terrains for Unity3D

Terrain by Vincent Ferrand

Generating Complex Terrains for Unity3DEric Hackathorn

9/10/2012

Page 2: Generating Complex Terrains for Unity3D

Preparation

You should be done with

this!

Download material from the classroom web site

Page 3: Generating Complex Terrains for Unity3D

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

Page 4: Generating Complex Terrains for Unity3D

Overall Device Structure

Page 5: Generating Complex Terrains for Unity3D

Terrain Generation Overview

Page 6: Generating Complex Terrains for Unity3D

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.

Page 7: Generating Complex Terrains for Unity3D

Radial Gradient

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

Page 8: Generating Complex Terrains for Unity3D

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.

Page 9: Generating Complex Terrains for Unity3D

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.

Page 10: Generating Complex Terrains for Unity3D

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.

Page 11: Generating Complex Terrains for Unity3D

Terrain Height Map

Page 12: Generating Complex Terrains for Unity3D

Bitmap Generation Overview

Page 13: Generating Complex Terrains for Unity3D

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.

Page 14: Generating Complex Terrains for Unity3D

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.

Page 15: Generating Complex Terrains for Unity3D

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.

Page 16: Generating Complex Terrains for Unity3D

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.

Page 17: Generating Complex Terrains for Unity3D

Channel Combiner

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

Page 18: Generating Complex Terrains for Unity3D

Terrain Distribution MapsSplat Map

Grass Distribution

Tree Distribution

Page 19: Generating Complex Terrains for Unity3D

Output File Overview

Page 20: Generating Complex Terrains for Unity3D

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.

Page 21: Generating Complex Terrains for Unity3D

Import into UnityHeight Map Splat Map Grass Map Tree Map

One small last part…

Page 22: Generating Complex Terrains for Unity3D

Height Map

Page 23: Generating Complex Terrains for Unity3D

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.

Page 24: Generating Complex Terrains for Unity3D

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.

Page 25: Generating Complex Terrains for Unity3D

Questions?Eric [email protected]