- Home /
Terrain texture painting
Hello. I want to be able to change terrain texture at run-time, the way it works in the editor. So moving the mouse with left click and "paint" it to the terrain. The only thing I can't handle yet is splatmap painting. How do I do that in a script, how does world positions relate to splatmap positions and so on? Also, how can I read/print the names of the assets loaded with Resources.Load (xyz.jpg > xyz)?
@tanoshimi would answer better than me, but for a good start, read this, I'm working actually with it and I'm learning like you...
http://answers.unity3d.com/questions/752413/avoid-freezing-on-changing-the-splatmap-of-nine-te.html
There you can see the problems of changing map alphamaps via code... :P
In addition, I recommend you to read this other question made by users like you (starting on this, I mean):
http://answers.unity3d.com/questions/12835/how-to-automatically-apply-different-textures-on-t.html
http://answers.unity3d.com/questions/541036/how-to-reset-terrain-alpha-maps-in-runtime.html
Basically, as you can see an Alphamap is made of a three dimensional float array that represent Width, height and the layer...
Ok, I already made it. But I still have a problem. When I create a circle brush to imitate the one in the Unity Editor, it lags a lot. I set the alphamap for every point inside the circle, but this causes a lag. With only one point, its speed is normal. Does anyone know, how does the Editor do this without lags?