Search Unity

Accessing Terrain Maps

Discussion in 'Scripting' started by phaez, Oct 7, 2013.

  1. phaez

    phaez

    Joined:
    Oct 1, 2013
    Posts:
    30
    Can't find the API information explaining how to access the maps for terrain. All I want to do is apply a basemap by grabbing the Diffuse texture off another object and sticking it on a Terrain object.
     
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    It's all in the TerrainData class. However the basemap is not something that can be applied like that; it's calculated from the splatmaps and textures.

    --Eric
     
  3. phaez

    phaez

    Joined:
    Oct 1, 2013
    Posts:
    30
    For the sake of completion (in case someone later Googles and finds this thread)...

    I was looking for the wrong thing in the API. There isn't really a concept of a distinct diffuse base texture in Unity terrain. For color, the terrain simply uses a stack of textures called splatPrototypes. Another thread discusses it here:

    http://forum.unity3d.com/threads/117310-Programmatically-add-textures-(splat-maps)-to-terrains

    To get a single texture on a terrain, you've got to add at least one splat prototype.