Applying terrain shader to mountain mesh?

polycounter lvl 3
Offline / Send Message
Mant1k0re polycounter lvl 3
I created a couple mountain meshes with world machine and then imported them to Unity 5, but I can't figure how to use terrain shader with it. If I create a new material with said shader no texture slots show, if I had a terrain component no dice either, I cannot trick Unity into thinking my mesh is a terrain. Is there a solution for this?

I could use standard and a detail map but I would be limited to 2 textures and I would like to use at least 3... And I have that nice splat map exported from WM that I would like to use as well :)

Thanks for pointing me in the right direction.

Replies

  • Farfarer
    Offline / Send Message
    Farfarer Polycount Sponsor
    I think there's a few scripts around that can take a heightmap from World Machine and apply it to a terrain chunk.
  • Mant1k0re
    Offline / Send Message
    Mant1k0re polycounter lvl 3
    Hey Farfarer, thanks for your answer!

    So you're suggesting to actually turn that mesh into a little terrain in itself? This can be done easily - I think I can just use a height output node after a mesh output one. Then use that to create a secondary terrain in unity and adjust the size to my liking. It sounds a bit convoluted though, I wonder if I shouldn't be looking for a custom shader with some of the propriety of Unity's built-in terrain shader, including the possibility to use externally made splatmaps...
  • Eric Chadwick
    I'm sure that kind of shader is on the Asset store. But terrain has built-in performance features which regular meshes don't, like auto LOD, etc.
  • Mant1k0re
    Offline / Send Message
    Mant1k0re polycounter lvl 3
    Yeah, but I probably don't need that for what I want to use this mesh for - it's sort of a background moutain/vista. I just wanted to leverage WM script to use the procedural splat map I made instead of having to blend textures manually. I didn't get any answer from the Unity forum either, if/when I find a solution to my issue I'll make sure to post it here.
  • Eric Chadwick
    Have you searched the Asset Store yet?
  • Farfarer
    Offline / Send Message
    Farfarer Polycount Sponsor
    Mant1k0re wrote: »
    Yeah, but I probably don't need that for what I want to use this mesh for - it's sort of a background moutain/vista. I just wanted to leverage WM script to use the procedural splat map I made instead of having to blend textures manually. I didn't get any answer from the Unity forum either, if/when I find a solution to my issue I'll make sure to post it here.
    The splat map is just an RGB texture. You could swap it out with your own.
  • Mant1k0re
    Offline / Send Message
    Mant1k0re polycounter lvl 3
    Thank you both for your help :)

    Eric:

    No, I'm not 100% sure about the key words, tbh. Also, I stumbled over this course at Gametutor and it seems to be covering how to make custom splat map shaders. What Farfarer said made me realize it might not be so hard to make yourself, plus it's about time I started looking into node-based material editors. Shader Forge is cheap and reportedly almost as robust as Unreal built-in editor.

    So I will be watching this today and posting what I figured afterward. Maybe this thread will be useful to others in the end!
  • Mant1k0re
    Offline / Send Message
    Mant1k0re polycounter lvl 3
    Well, self-education took a lot longer than expected on this :) Ultimately I got tired of Unity's clunkyness and reliance on a quagillion 3rd party plugin (Shader Forge being one of them, but also no built-in vertex painting tool...) so I started looking at Unreal instead and found solutions immediately, that didn't require making purchases in the damned asset store. SO in unreal it's pretty easy to make such a shader and hereafter is a video showing how - I didn't bother to try and replicate it in shader forge but I imagine this might help whoever is looking into doing it for Unity. Me, I definitely jumped ships :)

    [ame="
  • Chimp
    Offline / Send Message
    Chimp greentooth
    terrains are a nightmare. It's an area of game dev that needs some love. it's late night and I've had terrain nightmares lately so here's some thoughts:

    Steer clear of triplanar, it's fantastic for concepting but bad for production -- typically very expensive.

    The most obvious option is to do a 4-splat shader, either with vertex colours or a rgba texture -- green for grass, red for rock etc. --- but this can be fairly expensive depending on exactly how you're doing your shader. If the terrain itself is front and center you're probably wanting PBR and POM and this is likely going to be at least 12 texture reads and very bad.

    You could consider 2-splat which is much cheaper, and split your mesh up intelligently, and cover the seam. Don't forget a 'base map' over the top, world machine can generate these.

    Ultimately, I'd suggest going with the simplest shader possible and letting foliage/grass/prop meshes do a lot of the work.

    Here's some fun terrain shader features we've experimented with lately that you might want to look into if performance aint a worry:
    - multi-uv blending in the distance to hide tiling
    - directional and oriented blend textures for things like 'dynamic' snow
    - you may want to consider blending in a perlin style normal map in the distance or up close or multiple times at different scales or whatever. noises do wonders.
Sign In or Register to comment.