Hey all unity3D members for a while now iv been messing around with Terrain API features iv made a script that randomly generates hills on a terrain befor the map starts making the map always random when you go into it now the problem im having is how can i texture the terrain if lets say a hill is at a specified height can i only apply a rock texture to it and everything else will be grass iv spent 4 hours trying to figure this out and 2 hours looking at forums but nothing is helping me so please can anyone help me.
Sorry iv been looking it up but i dont quite understand how its ment to automaticly apply texture to a hill thats been randomly generated could you please give me an example of how to do it? because isnt a splat map just an image of red,blue,black,green and the textures in a shader specify what textures are filled in with that?
Yup. Simply grab the splat map with TerrainData.GetAlphamaps. The third dimension of the array is the texture you are using. Set it to one at the position you want. Then reassign it with SetAlphamaps.
Sorry im still a little confused how is it meant to texture based on the current hills on the terrain if the texture is deffined where to be placed on the splat map?
(fair warning: i have not played with this in unity5 yet)
The splat map color values are used to indicate how the terrain textures are blended onto the terrain.
To try this out add 3 terrain textures (say sand, grass, hill) in the editor as if you where going to hand paint the terrain.
Then instead use your script to grab the splat map and assign the weights of the different textures based on the height of your terrain. (or perhaps use an over obvious test pattern to ensure its working before basing it on your heightmap)