Search Unity

Free triplanar terrain shaders

Discussion in 'Assets and Asset Store' started by Vade-Mecum, Nov 15, 2015.

  1. Vade-Mecum

    Vade-Mecum

    Joined:
    Dec 10, 2012
    Posts:
    17
    Hi! I've fiddled a bit with standard terrain shaders so i made them triplanar. Also it's possible to adjust color multiplier of each individual texture. All works just like standard terrain shader, uses terrain maps, you just have to adjust tiling, offset and color of textures in the material. Summary it works just like standard shaders, but looks good on the cliffs and canyons.
    UPD. I had to make them local normal mapped, because for some reasons world normals just won't work in some conditions. I'm working on it.
     

    Attached Files:

    Last edited: Nov 15, 2015
    twobob, RavenOfCode, mbbmbbmm and 8 others like this.
  2. Vade-Mecum

    Vade-Mecum

    Joined:
    Dec 10, 2012
    Posts:
    17
    Please tell me in the comments about it's work. It seems like some people can't get worldNormals in the shader and get textures streched allover. I'm fixing it right now.
     
  3. Vade-Mecum

    Vade-Mecum

    Joined:
    Dec 10, 2012
    Posts:
    17
    I're fixed the issues, changing the world normals to local normals. Still, normals inverted and some blending are not fully correct. If you have any ideas how to fix this, contact me pls. Main post archive updated.
     
  4. Adam-Bailey

    Adam-Bailey

    Joined:
    Feb 17, 2015
    Posts:
    232
    Slightly old thread but thanks for this!
     
  5. Alverik

    Alverik

    Joined:
    Apr 15, 2016
    Posts:
    417
    Hi, I'd just like to know how did you get it to work? I tried it but I see no difference at all... (Unity 5.5.0f3)
     
  6. Adam-Bailey

    Adam-Bailey

    Joined:
    Feb 17, 2015
    Posts:
    232
    Create a new material using one of the shaders in the package then set your terrain to use that material.
     
  7. Alverik

    Alverik

    Joined:
    Apr 15, 2016
    Posts:
    417
    Thanks, I figured out the issue. I've just started using Terrain Composer 2 and I didn't notice I was slotting the material in the Editor view settings, once I put it on the Runtime view settings it started to work. It does look quite shiny though, is it using the alpha of the textures as the shininess or something? (Never mind I got it, I think).
     
    Last edited: May 20, 2017
  8. Alverik

    Alverik

    Joined:
    Apr 15, 2016
    Posts:
    417
    Hi, first, thanks! I tried several free triplanar terrain shaders and yours are the best :) (others just didn't work or were limited to 4 textures).

    Now, I was wondering... how hard would it be to add Multi UV mixing, like shown in this thread? The method shown in there seems simple, but this are surface shaders, right? Should I modify the color variable in SplatmapFinalColor in the cginc or does it need to be done differently? Does anyone have any ideas?
     
  9. Regifie

    Regifie

    Joined:
    Feb 13, 2017
    Posts:
    1
    Hi everyone!

    I'm also struggling to get this to work. I have created a material with the supplied shaders, but when I slot this into the terrain, I hardly see a difference. Yes the terrain get a bit shinier, but I see no changes whatsoever on my cliffs.

    If anyone has a suggestion that'd be much appreciated!

    Thanks!
     
  10. Alverik

    Alverik

    Joined:
    Apr 15, 2016
    Posts:
    417
    Make sure the shaders have compiled correctly. Unfortunately some critical shader errors don't stay in the console like for regular scripting warnings. Click your shaders to make sure there are no red warnings in the inspector. If there are you'll want to fix the error (common one for old shaders are some uninitialized variables, but you'll usually find the fix easily in the internet for those).

    Also, I think this is for forward rendering too, not deffered. I'm not really sure if there are any other requirements. I've encountered situations when the difference seems to be slight in some terrains, but work great on others. But, well, just like the OP said the shaders aren't perfect. I've noticed it doesn't work quite so well when the geometry is very extremely stretched (like very pointy and sharp peaks for example), in such cases the texture still seems to stretch a bit in those. It could also be a matter of size too I guess, I remember that the terrain where it looked the best was not that big, but I'm just guessing here...

    PS: also remember to play with the scales for the UVs in the material, higher numbers (0.1, 0.2, etc) will give you better tiling in large terrains (default is too tiny).

    PS2: for the shininess, just lower the alpha of the colors in the material (it's using alpha as gloss), OR change to the specular version and just adjust the shininess slider.
     
    Last edited: May 22, 2017
  11. guinea6

    guinea6

    Joined:
    Feb 6, 2017
    Posts:
    7
    i have no idea why the shader keep getting error where it cant get splatmap file when it is right beside the shader files.