- Home /
How do I extract a texture map from a terrain?
I used the Export Terrain script to generate a .obj and opened it in Maya.
I'd also like to get my procedurally generated texture map out (I was using TerrainToolkit) so I can work with it in Maya and Photoshop.
Is there a way to do this?
Answer by VivienS · Apr 11, 2011 at 10:01 AM
As far as I know, there is no complete "procedurally created terrain texture" in Unity, because as a single map it would have to be an enormous file. Instead, the terrain texture is a result of the tiled terrain textures you assigned via the inspector and a splat map.
To get the best quality in Maya, I'd suggest you export the splat map and use the HyperShade to recreate the procedural map from Unity. I did a similar thing some time ago, and it worked fine (If you want, I could explain the Maya shader-setup).
You can view your splat map in the project panel: it is a child of your terrain object. Select the splat map in the project panel and convert it via this script into a PNG:
// For saving splat map as PNG file. import System.IO;
@MenuItem("Assets/Export Texture") static function Apply () { var texture : Texture2D = Selection.activeObject as Texture2D; if (texture == null) { EditorUtility.DisplayDialog("Select Texture", "You Must Select a Texture first!", "Ok"); return; }
var bytes = texture.EncodeToPNG(); File.WriteAllBytes(Application.dataPath + "/exported_texture.png", bytes); }
Source: The script is mentioned in this forum thread.
Alternatively, I'm sure you could find a script to export a scaled down version of the terrain map.. (or the quick and dirty method: just take a screenshot from the top view) ;)
Oh yeah.. and you have to re-import the splat map again, if you want to use it in unity.. quite the exhausting workflow ... ;)
Your answer
Follow this Question
Related Questions
Can't paint more than 8 textures on terrain 3 Answers
Terrain Texture Android And OpenGL ES 1.x 1 Answer
Paint textures like on terrain but without terrain? 0 Answers
cannot find terrain texture 0 Answers
Details texture casting shadows ? 0 Answers