If I create a terrain in a 3D modeling program, apply a simple cubic mapped texture to it, and import it into Unity, it looks great. No stretching of the texture on the steep parts of the terrain, it looks just like it did in the 3D modeling program.
But if I create the terrain in Unity and apply that same texture, it looks terrible, all stretched and distorted. A special tri-planar shader is required to make it look right. Which adds overhead that I could do without in a mobile app.
Why? Why do I need a special shader for terrains created in Unity but not for those imported into Unity?
I like Unity’s terrain sculpting tools, so I’d prefer to use them to create terrains. But what it looks like I have to do if I don’t want to use special shaders is to create the terrain in Unity, export the height map, import the height map into my modeling program, apply the texture, and export back to Unity. A bit of a pain, but doable, except it’s virtually impossible to match the Unity terrain to the one that’s been exported and imported. They’re close, but never an exact match. Which means some tweaking is required, and the process gets very time consuming.
Unity terrains are made with heightmaps, which are 2D data, so they have various limitations such as this (the textures are essentially top-down projected), with the benefit of using little memory to depict large “3D” areas. The usual technique is to use heightmaps for areas where they work well (not really steep slopes/cliffs) combined with actual models that can be UV mapped appropriately for the problematic areas (the really steep slopes/cliffs).
Is there any benefit in memory or speed to using Unity terrains versus an imported terrain? They’re both 2D objects with the same number of polygons and appear identical in Unity. What about versus a Unity terrain with a tri-planar shader, assuming everything else is the same?
Yes, Unity terrains take much less memory since they are heightmaps, rather than storing explicit vertex info, and vegetation is stored in a similar way. I’d be surprised if a triplanar shader is particularly less efficient than a splatmap shader.
That’s very interesting and informative. If terrains are so efficient, then why are they not recommended for mobile? I’ve seen lots of references to not using terrains on mobile apps, and just recently in another thread someone told me terrains should be avoided on mobile.
FWIW, the terrain I’m trying to create is the simplest possible. No trees or anything else, just a surface (plane) with a diffuse texture.
There’s a certain amount of overhead involved (and the current implementation could be optimized), so if you only have a surface, it’s probably overkill.