Home Unity

Unity (5) // Mesh / Vertex Painting for Texture / How ?

polycounter lvl 8
Offline / Send Message
retmia polycounter lvl 8
Hello Polycounters !

I'm working on some grounds on Unity 5, and I want to mix textures to create variety. I've done it for film in the past inside Maya, and I was thinking it would be easy to do in Unity. I've seen that it's a very basic feature in Unreal Engine 4 ... But in Unity, it's not a smooth workflow at all, there is no native shader, nor native tools to do it. :(:(:(
I found some assets that do it, but I'd rather use less external packages as possible. Plus they are all dated from before Unity 5 and are not PBR compatible.
I don't care to paint in Maya or in Unity. But the real problem is that the shaders that I found are not PBR compatible.

So I was wondering how do you guys, handle that with Unity ? Modified standard PBR shader ?

Here's a quick Technical illustration, done with external asset, and not PBR compatible (and we want it to be compatible without use of external packages) :

tYJ2uKY.png

Replies

  • retmia
    Options
    Offline / Send Message
    retmia polycounter lvl 8
    Well, I've been hearing here and there that Shader Forge makes good materials and allows that kind of blend. Have some of you tried to work with it ? :polytwitch:
  • jfitch
    Options
    Offline / Send Message
    jfitch polycounter lvl 5
    I would do it by setting up the vertex colors in another program, like maya, and then writing a custom shader with textures based on vertex color and some sort of alpha blending.

    EDIT: Look into the terrain surface shader. I know it says terrain but it's just a version of the standard shader that lets you blend between to sets of textures based on a mask. Looks pretty nice. I'm sure you could edit the shader pretty easily to add more layers as well.
  • retmia
    Options
    Offline / Send Message
    retmia polycounter lvl 8
    Well thank you jfitch, after having looked all over the internet, it seems that painting outside the Engine and importing back the models is the best approach I could find, I've managed to drive diffuse, normal and specular maps with that technique. Not yet compatible with PBR, but it should be soon as Unity 5 is young and plugins are quickly made compatible :)

    EDIT : I've tried the terrain shader. It's quite good, very close to what I need (it misses a texture input for specular), but unfortunately it can't be used on custom objects :/
  • retmia
    Options
    Offline / Send Message
    retmia polycounter lvl 8
    What it looks like with terrain shader :
    If4VYoa.jpg

    With good maps, it would be very nice ! Too bad we can't use the shader on other objets than Terrain :poly116:
  • botanika
    Options
    Offline / Send Message
    botanika polycounter lvl 3
    I can make one for you, since I'm gonna need one anyways. but you'll need to tell me how many maps you're planing to blend and whats the blending method of your choice, and if all your materials are dielectric.
  • retmia
    Options
    Offline / Send Message
    retmia polycounter lvl 8
    Hello botanika, well that's a very interesting proposition ! I'm not in a urgent need, so if someday you manage to produce a nice shader like that, let me know ! The ideal would be to be able to drive maps with the four possibilities : black / red / green / blue :) Thanks :)

    I think Shader Forge's developper is hardly working on making his software compatible with the new native PBR rendering, I've tried it and at the moment it's not flawless at all, but I can't imagine him working on something else !
    I wanted to try to manually edit the new Standard shader, it's a file called unity_builtin_extra, but it's quite gigantic : 280 000 lines of code !! so with my micro knowledge of coding I couldn't do much with it !
  • retmia
    Options
    Offline / Send Message
    retmia polycounter lvl 8
    http://acegikmo.com/shaderforge/changelog/

    It's confirmed, Shader Forge 1.1 is planned with PBR native implementation :)
  • botanika
    Options
    Offline / Send Message
    botanika polycounter lvl 3
    I quickly ran out of textures interpolation, when trying to blend 4 maps, with 3 textures each (Albedo/Spec/Normal), on shader model 3.0. the only solution I found is to replace the Green/Blue channels specular textures with colors.

    Here is what I got so far :

    lerp blending : N76MoGhkwvO5KwOHo_BrTb0g-qdqMDV6jjlrM_h9rNRt5mb0AXMTPF8mGxLUVLZXidoLkLeE9dE=w1332-h547

    826Mr6Q.jpg
    Height Blending :

    e3b8qkIXSHTO1w7OS4EgLeK_RtR258uuYydG52vUmNSfTcVfcclnr9cgTpM_wWEdEJpbwPbYoas=w1332-h547y8iaAtc.jpg


    If this is what you want, you can get the shaders from here :
  • botanika
    Options
    Offline / Send Message
    botanika polycounter lvl 3
    btw, Synoptic-Entertainment guys offer this vertex painting tool for free, you can use it to paint your meshes inside of unity.
  • retmia
    Options
    Offline / Send Message
    retmia polycounter lvl 8
    Wow thank you ! That's very impressive !
    I didn't know we could do that. It's a step higher in terms of quality and map blending possibilities !

    Here's my quick test with bad maps :
    RMRmzOh.jpg

    So, under the hood, the idea is to blend value between the alpha mask and vertex value ? is that it ?

    I'm not used to work with an Alpha Channel inside image files, I've used TGA 32bit to make it work, do you know if it's an optimal format ?

    Anyway, thank you again, awesome awesome work ! :):)
  • Eric Chadwick
    Options
    Offline / Send Message
    32bit TGA works fine in Unity, the game converts it to the appropriate compressed format automatically.

    We have some introductory info about this on the wiki, FWIW
    http://wiki.polycount.com/wiki/Texture_formats
  • botanika
    Options
    Offline / Send Message
    botanika polycounter lvl 3
    retmia wrote: »
    So, under the hood, the idea is to blend value between the alpha mask and vertex value ? is that it ?
    Yes ! :) the bright values in the alpha mask will pop up first, followed by the dark ones. that's why Height/displacement maps are commonly used as masks.
    retmia wrote: »
    I've used TGA 32bit to make it work, do you know if it's an optimal format ?

    As Eric said, Unity automatically convert your source images to compressed format for the game. you can use any format you want, that support alpha channel ( PSD/TGA/TIFF/PNG .. etc).
  • retmia
    Options
    Offline / Send Message
    retmia polycounter lvl 8
    Thank you guys ! By combining your advices and doing research I made some good progress !
    I found that we can bake AO in the vertex color !! It should allow some nice effects ...

    So what's really needed now, is a good vertex painting tool, inside maya if possible. I've heared about Vertex Chameleon, it seemed quite powerful but it's no longer developped and is not working anymore on version 2015 of maya :( And unfortunately I didn't find any other plugin that seemed to propose some vertex color painting tools :/
    Native tools of maya don't allow a per channel appoach, and that's quite annoying because when you add blue to red, il firsts want to go through green like color does, so in the shader, it blends a map that should'nt be there :/
    Apply Color function allows a per channel coloring, but it's a per selected vertex tool, not very practical to work with a hundreds of assets to have to produce :(

    Any Advice ?

    For the fun, that's where I'm at with ShaderFX on maya ; It's a big mess, but potential is here !! :)

    fHvEYZw.jpg
  • another caveman
    Options
    Offline / Send Message
    another caveman greentooth
    Hi,
    I am having the exact same problem. Can't find anything all the package links are dead - including the one you posted here, could anyone reupload? I know it's been a while but still trying...

    I have to do the exact same thing - paint pbr shaders on a mesh, in Unity.

    Any answers?




  • Eric Chadwick
  • reanimate
    Options
    Offline / Send Message
    reanimate polycounter lvl 10
  • cptSwing
    Options
    Offline / Send Message
    cptSwing polycounter lvl 11
  • Chimp
    Options
    Offline / Send Message
    Chimp interpolator
    There's more than enough shaders available, I would personally recommend the Alloy shader package that comes with a bunch that do this. The team provide great support too. If you want a fiddlier but free tool, you might want to try Lux. Do the vert painting outside or pay a programmer to write you a simple but effective vert painter with pressure support or something :)

    Or go to Unreal. Unity is positioned at the opposite end of the spectrum - it is a sort of blank canvas for you to work with in a relatively free but highly manual fashion, whereas unreal provide a hell of a lot but you have to do things in a much more specific way.
Sign In or Register to comment.