Home Technical Talk

Stacking Double RGB Vertex color Info into 1 Vertex Painting potential solution.

polycounter lvl 9
Offline / Send Message
eyasuu polycounter lvl 9
Hello fellow polycounters.

Thought I'd share a potential solution to how Naughty Dog is having more than the one set data in their Vertex Painting Setup for the Last of Us part 1.

You can view the awesome talk here. https://www.youtube.com/watch?v=DEuYcOWNV2k @17:45 and 32:45.

There is a lot of potential room to play here. And some polish in the area of the Alpha channel (which I explain below). But hope you enjoy, will improve or use this vertex painting tool/ theory. More testing and experimenting is to be had.

This was built it UE4.27 and should work in other engines too.





I am unsure exactly how to post videos on polycount. But there is a video demonstrating it on my artstation. (sorry don't know how to link. https://www.artstation.com/artwork/9E1Wra)

Thanks for looking and have a great day!





Replies

  • dimwalker
    Options
    Offline / Send Message
    dimwalker polycounter lvl 15
    I'm not sure I understand the trick. You can mix 4 textures using vertex colors without touching vertex alpha.
  • eyasuu
    Options
    Offline / Send Message
    eyasuu polycounter lvl 9
    Might have completely misunderstood this section of the talk; interpreted the stacking of the texture sets as two chains of vertex colors and not one chain.

    So instead of lerping between just A and B on the red channel you are lerping between A, B, C, & D on the red channel, and on the Green channel and on the Blue channel. Something to that affect?  ** edit**  Like two stacks of vertex painting information data

    Though i haven't tested down the GB line because of time. Could completely break. 

  • dimwalker
    Options
    Offline / Send Message
    dimwalker polycounter lvl 15
    Ah, so It allows to have up to 8 textures to mix together using vertex color and alpha.
    A bit of an offtopic, but first thought I had after reading a title is split UVs of vertex color/alpha to have rough transition between values. Not sure it even makes sense with other software or file formats, but 3dsmax allows for some funky stuff when it comes to vertex color/alpha.
  • Eric Chadwick
    Options
    Offline / Send Message
    I think they are simply blending together multiple tiled textures, this is a fairly common setup with vertex painting. Clean brick wall. Mossy wall. Cracks. etc. Each is a tiled texture. 

    Another setup, this allows 16 textures to be blended by using only one of the three color channels (green) within a single set of vertex color data. If you want texture one, you paint 0-15 green. To get texture 2 you paint 16-31 green. Etc.
    https://polycount.com/discussion/174377/witcher-3-blood-and-wine-architectural-material/p1

    We have more resources about this on the wiki
    http://wiki.polycount.com/wiki/MultiTexture
  • poopipe
    Options
    Offline / Send Message
    poopipe grand marshal polycounter
    It's worth pointing out that they have a proprietary engine and that there's no reason you cant store multiple vertex color sets in a model so they probably just do that for simplicity's sake. 
    This is also what the slides suggest they did so I think it's a safe bet.

    The simplest option if you only have 4 channels is to do as Eric suggests and handle multiple textures in a single channel.you lose precision but it's unlikely to be an issue in practice.

    Storing vertex color in UV sets is a perfectly valid approach -   it's more data but if you need the precision it's your best option. 

     
  • eyasuu
    Options
    Offline / Send Message
    eyasuu polycounter lvl 9
    I think they are simply blending together multiple tiled textures, this is a fairly common setup with vertex painting. Clean brick wall. Mossy wall. Cracks. etc. Each is a tiled texture. 

    Another setup, this allows 16 textures to be blended by using only one of the three color channels (green) within a single set of vertex color data. If you want texture one, you paint 0-15 green. To get texture 2 you paint 16-31 green. Etc.
    https://polycount.com/discussion/174377/witcher-3-blood-and-wine-architectural-material/p1

    We have more resources about this on the wiki
    http://wiki.polycount.com/wiki/MultiTexture


    oh nice and thanks! haven't seen that post. Thanks again, def going to read up on that technique.


    poopipe said:
    It's worth pointing out that they have a proprietary engine and that there's no reason you cant store multiple vertex color sets in a model so they probably just do that for simplicity's sake. 
    This is also what the slides suggest they did so I think it's a safe bet.

    The simplest option if you only have 4 channels is to do as Eric suggests and handle multiple textures in a single channel.you lose precision but it's unlikely to be an issue in practice.

    Storing vertex color in UV sets is a perfectly valid approach -   it's more data but if you need the precision it's your best option. 

     


    How would one export multiple color sets out of maya? Quickest thought, would this be like transfer maps? Baking the vertex color into a uv map?

    Wasn't 100% sure where exactly to look for and word this after GDC, and it was mentioned to us that it was a proprietary tool. So thought I'd try and hack something together. 

    Sorry for the late replies.
  • Eric Chadwick
    Options
    Offline / Send Message
    If FBX supports multiple UV sets, I would look into that first. But Unreal would also need to support importing those UV sets. 

     Vertex color is just numbers in the end, which is part of why it’s so efficient (less memory use than textures). So you can use a UV set to store vertex color instead of texture coordinates.
  • poopipe
    Options
    Offline / Send Message
    poopipe grand marshal polycounter
    I think fbx as a format supports multiple sets - it certainly supports <n> layers of data. I'm not sure that any of the major exporters/importers handle it though. 

    To store the color in UVsets you can use channels in max, I'm not sure if there's a way to do it through the UI in maya

    the path of least resistance is to pack it all into the first vertex color set
  • Eric Chadwick
    Options
    Offline / Send Message
    Yeah. Also, using Transfer Maps to bake vertex color into a texture is not the technique that’s used in games. Defeats the purpose of using memory-efficient vertex color.
  • Shrike
    Options
    Offline / Send Message
    Shrike interpolator
    You can already use up to 7 colors with just 1 vertex but you have to be careful in which order you use them to not have seams
    Black
    Red
    Pink
    Green
    Yellow
    Blue
    Teal

    You can also take half the range on colors to get 2 out of 1 color
    But do you really need or want so many layers? Its not for free of course.
    Id also just put some things with worldspace noises simply
  • poopipe
    Options
    Offline / Send Message
    poopipe grand marshal polycounter
    youi're missing white so it's 8 by that logic

    however.. 
    if you use vertex color in most engines (eg. unreal) it's a fixed cost - you don't save anything by using only 2 channels because the data is stored as a vec4.

    At worst you have 8-bit precision - giving you a potential total of 1024 unique 1 bit masks.
    I've shipped a game using 16 in a single channel for per triangle material masking so I know that works, there's no good reason you couldn't go up to 255 per channel though.
     
    Splitting each channel into 4 is usually good enough to support reasonable blending between materials if you're modulating it with noise/textures - this gives you a total of 16 masks to play with and is approximately the same level of precision you'd get from a packed set of texture based masks. 


    vertex color isn't inherently more memory-efficient than using textures - the per point cost is at best equal to a single pixel (most likely higher). There's usually less vertices than pixels obvs but it's not a given. 
    Transfer attributes in maya supports moving vertex color around  - there's lots of nice texture to vert data tools in there as well so you could use photoshop/designer to encode your data and push it back into vertex color if you're not comfortable scripting it

  • poopipe
    Options
    Offline / Send Message
    poopipe grand marshal polycounter
    deleted ...something went wrong there...

  • Shrike
    Options
    Offline / Send Message
    Shrike interpolator
    Yeah I guess youre right, white could also be used I suppose
    1 bit masks are not super useful tho, with the 8 colors you do have pretty good quality still

    Its not fully true with the fixed cost, (havent tried nanite compression tho)
    I checked the sizes and if your number is 0, it naturally costs less memory than if you have some float in it, at the least on the disc. The more rounded the down the float, the less memory, with 0 taking the least, so you do save some memory if you don't use one channel, but I doubt that it saves any measurable material performance

    If you have a higher poly mesh using vertex colors that does make a difference in size
  • poopipe
    Options
    Offline / Send Message
    poopipe grand marshal polycounter
    Disk size is irrelevant because the data is converted into the engine's mesh format before it is digested. 
    The values assigned are irrelevant because the datatype used to store the information is what determines size in memory

    an 8bit number costs 8bits whether the value is 00000000 or 11111111 

Sign In or Register to comment.