b03 b04 b05 b06 b07 b08 b02 b01

3dNemo Tutorials

     
  t01  
De Google Earth a Unity - ISLA KAUAI

Cómo extraer datos de Google Earth para utilizarlos como referencia para la creacióm de terrenos realistas en Unity. En este ejemplo tomaremos como referencia la Isla Kauai del archipielago de Hawai.

Imagen de Unity usando el objeto Terrain.
 
  ge1  
Extraer datos de Google Earth:

First in order to extract terrain data from Google Earth you need SketchUp Pro (another App. from Google). There is a trial version (it seems full functional) for 8 hours of usage.

1- Open Google Earth and go to your target location.
2- You must be about 500 m of altitude.
3- Open SketchUp Pro and select "Tools:Google Earth:Get current view" or something like that (sorry, I work mainly in spanish)
4- Select now "Tools:Google Earth:Togle terrain"

Kauai Island as shown in Google Earth
 
  ge2  
 

At this moment you have a mesh with a b/w texture of the terrain in it, in order to get the colour texture, switch back to Google Earth and select "File:Save:Save Image", if you make it carefully, the image saved is the exact texture for the terrain.

But ...

As said you must be about 500m above the terrain to get a good mesh, you can capture at higher altitudes but you'll get a very low resolution mesh.

Sketch Up pro captured pieces from Google Earth
 
  ge3  
 

So, you must capture a piece of terrain and the image in Google Earth, move slightly and capture again and so on. Even if you don't move at exact increments, SketchUp Pro will place the pieces of terrain in a correct way.

At the end you will have a 3d model of the terrain made of several overlaping meshes that you can export as 3ds format. Then you will stitch the meshes in 3DStudio or your favorite 3D program, don't worry about the UVs (texture coordinates) at this moment.

Sketch Up pro mesh captured at about 3 km altitude above the Google Earth window
 
  ge4  
 

About the texture, take the several images you got from Google Earth, compose a single image in Photoshop, with of all them. You can now make a "planar" projection of the texture over the terrain.

Maybe you'll have to tweak a little but, although a tedious process it is possible to get good results.

Tip: As the texture UVs are not important, you can trace roughly a square route around the area you are interested and if you have a very big monitor you can get larger images in less steps to get the whole area texture. Anyway the elevation data must be made in 500 square meter pieces.

 
 
  ge5  
Dando forma al objeto terreno en Unity:

Look for:

"Physics.RaycastAll" in Unity scripting manual, you must set a "Mesh collider" for your 3DS terrain model.

Then use "terrainData.GetHeights" and "terrainData.SetHeights" in a "for" loop.

So, place the 3DS terrain mesh over a Unity Terrain the same size (is better to make a square mesh in 3DS, because the Unity terrain is always square), cast a ray downwards over the mesh, get the "y" coordinate, and set the Unity terrain height.

 
 
  ge6  
 

Then you can cast the texture in the terrain setting "Tile size x" and "Tile size y" the same as "Terrain Resolution" in meters.

Now you can texture the terrain and place trees and details in it.

It's a very simple script and I'm sure you can get some help to do it in your location.