Home Technical Talk

How to automatically paint mesh depend on polygon height or angle? (Unity or 3ds Max)

ebbob
null
Offline / Send Message
ebbob null
Hello,

I have a mesh that I have to paint, but it's huge. Is there a way to automatically apply different textures based on poly height or angle? Using 3ds Max or Unity. Here is an example of the mesh.
Please help.


Replies

  • Mark Dygert
    Options
    Offline / Send Message

    It sounds like you want a shader that blends based on height and slope. If you stretch the terrain up too high and you get ugly distorted textures you will want to go with a shader that has "triplanar". 

    Max is pretty limited on this front. There is a small chance you could piece something together using the data channel modifier, or the box blending technique but really I wouldn't bother it's just not built to support that type of thing.

    Unity kind of leaves you twisting in the wind also, but only if you're not able to code your own shaders. If you could, you probably wouldn't be asking here so I'll assume you don't.

    You can sometimes find a shader in the Unity asset store or scrounge one up in some disparate community post, but it may or may not do what you need and it may be an un-optimized pile of garbage... not all shaders are equal, especially when you get into triplanar where it has to render the terrain 2-3 times.

    Using height and slope to blend materials is fairly common. This won't correct UV stretching on vertical surfaces like triplanar but it will do just the blending at a fraction of the cost. If you aren't stretching your terrain up too high, it might be a good option. 

    Option #1 Slope and Height for Unity
    https://www.youtube.com/watch?v=YGoUspj10QU

    Option #2 Triplanar shader for Unity
    https://www.youtube.com/watch?v=g_DtSgDCOSw
    I haven't used this shader but for a few bucks it's probably worth a look.

    Option #3 Switch to Unreal
    You can also switch to Unreal, which has a VERY robust material editor that builds complex shaders with a node based interface. It really is fantastic for non-programmers with tons of examples and tutorials out there. I have trouble going back to unity after having worked with Unreal. What would take me days in Unity to figure out, I can figure out in 20-30min in Unreal. I'm not that great with its material editor but the amount of help out there is astounding.

    Setting up slope and height in Unreal (no coding experience or external files required)
    https://www.youtube.com/watch?v=aDWF22A2sSg

    Setting up Triplanar in Unreal (no coding experience or external files required)
    https://www.youtube.com/watch?v=yP4Yhlztqw0
    It also plugs into the material landscape system and allows you to also paint the material layers. Honestly as far as free tools go, the landscape system in unreal is great for creating customized terrain, plus scattering foliage, and all of the super awesome stuff it does. I'm not going to lie it does have some wonkiness but it's lightyears above what Unity can do.


    Option #4 Use terrain generation software
    These allow you to generate height maps as well as "splat maps" for terrain masking. They create those masks based on similar paramters to slope, height and triplanar shaders, sometimes even going deeper to have soil layers and erosion functions that also factor into the splat maps.

    World Machine https://www.world-machine.com/
    The interface isn't much to look like and it's been around forever but it does fantastic work and is fairly easy to learn. It's a node based system that has a lot of tutorials and help to get it working. It gets used all the time to make amazing looking landscapes, you've probably seen a ton of them in games and never realized it.

    GeoGlyph (for World Machine) http://www.quadspinner.com/geoglyph/
    If world machine is pancakes this is some sweet ass maple syrup, straight from Canadian. It adds a ton of functions and material blends to world machine. It also improves the interface quite a bit. I have trouble using world machine without it but still, vanilla world machine is no joke it can probably do what you need it to do in no time 

    Planetside (formerly Terragen) https://planetside.co.uk/
    They've been around for ever and just when you think Terragen is dead it revived itself with a massive overhaul. They really are all about creating worlds not just terrain. It's pretty amazing and gets used in film and TV production all the time.

    World Creator https://www.world-creator.com/
    A new comer to the market with a sh!t ton of features and one hell of a sexy UI. They really focused on user experience and usability. I haven't used it in a production setting, yet, but I'm itching to try it out. I think it's going to be amazing. This tutorial series shows it off pretty well.

    TLDR:
    • Look for Slope and Height shaders for Unity
    • Triplanar if you have to
    • Think about picking up Unreal, it will make life easier
    • Investigate terrain generation software, it's good to have a rock solid terrain generation workflow

    Good luck!


  • Eric Chadwick
    Options
    Offline / Send Message
    I wish to hereby renew my subscription to the Vig Fan Club...!
  • ebbob
    Options
    Offline / Send Message
    ebbob null
    I wish to hereby renew my subscription to the Vig Fan Club...!
    What is the Club? Can't google it.
  • gandhics
    Options
    Offline / Send Message
    gandhics polycounter lvl 8
    You can use Falloff map or OSL.
  • ebbob
    Options
    Offline / Send Message
    ebbob null
    :'( thank you for ehlp mr. Dygert, but my work require Unity and all those options are not free...
  • ebbob
    Options
    Offline / Send Message
    ebbob null
    However, what terrain generator is the best? All of them are looking decent...
  • cptSwing
    Options
    Offline / Send Message
    cptSwing polycounter lvl 11
    Data Channel should be able to at least give you height-based vertex colors.. which in turn you could feed into a shader of some sort..
Sign In or Register to comment.