I saw a nifty material on the asset store that would automatically paint a grass texture on the top of a mesh and a rock texture on its sides. It even gave sharp edges for the grass instead of fading the texture.
I’m very interested in adapting such a material into my terrain, so that I could freely paint its shape as I need for my game and have the material automatically paint the surfaces I need.
But this would be a rather complex material, and I haven’t seen any option within the terrain to be able to actually replace the material, only to add textures to new layers.
Is there any way I can replace the material on a terrain to use a custom material like this?
Or better yet, is there any way I can have a layer in my terrain use a custom material like this instead of just the default layer material? That way I could blend between the custom material and other normal materials.
Failing any of that, is it possible for me to convert/export the terrain as a regular mesh?
I think you can assign a new material under the settings of the Terrain object. (gear icon) But the stuff that blends between layers by painting is depending on the material using a shader that was written with terrain abilities in mind.
That way I could blend between the custom material and other normal materials.
By which I mean, it’s not blending between materials, it’s blending between textures because it’s one material that was written to enable blending between textures.
This is a post on writing a custom terrain material, I don’t know how much they’ve changed how the terrain material works since then.
Ah, I found it finally!
Well, I got the custom material and applied it to the terrain. It works… partly right. It’s close enough to what I want that I can probably use it.
I get an error “Can’t use materials with shaders which need tangent geometry on terrain, use shaders in Nature/Terrain instead.” …but it doesn’t crash or cause the terrain to glitch out. so there’s that I guess?
Even if I can’t blend between the custom material and regular textures, I could still simulate the effect by carefully using two terrains. One has the custom material, and the other has the regular texture layers, including one that matches the custom texture. It’s not an ideal setup, but I can manage.
…Is there a way I can export a terrain to a regular mesh? I won’t need to worry about the custom material not working 100% right if I can just apply it to regular mesh.
It looks like there’s this, which will try to export a terrain as an obj file:
http://wiki.unity3d.com/index.php?title=TerrainObjExporter&_ga=2.72335059.173602113.1602525710-1978668736.1584214310
I don’t use terrain much. I’m surprised at the idea that terrain doesn’t have tangent geometry. The shader’s probably using tangents to offset a bump map based on view direction for the grass. I would have thought that bump mapping would be really useful for terrain. Maybe the terrain shader calculates its own thing based on normal or something?