Home Technical Talk

Vertex Color - a breakdown

polycounter lvl 7
Offline / Send Message
Tickwomp polycounter lvl 7
Hey guys,

Been looking into doing modular assets and I came across vertex colors; I'm not sure I understand what exactly it is. As I understand, it can be used to blend maps in UDK or for transparency, but I'm unclear....how it works?

Is it like an alpha map that you can change on the fly? How is it more efficient and what are some other instances it can be used?

I keep having this impression that it just applies a color or whatever at the actual vertex point. So for example, on a cube, if only one vertex is colored, that corner of the mesh has a colored gradient that blends outwards into the other connecting vertices, but this seems wrong, so if someone could explain this in layman terms that would be awesome :)

references:
http://www.philipk.net/tutorials/modular_sets/modular_sets.html
http://www.thiagoklafke.com/modularenvironments.html

Replies

  • fatihG_
    Offline / Send Message
    fatihG_ polycounter lvl 14
    Yup vertex colours are basically exactly what it says.

    Each vertex can holds a colour and this can be used like any other textures. Vertex/textures merely being something that contains data it makes perfect sense.

    There are lots of uses for vertex colors, you can bake lighting into them, AO, you can use them as mask (for blending of different textures.)
  • Bruno Afonseca
    It's just a RGBA value you can input to your vertices. What it actually does is up to the shader!

    Before lightmapping came, it was (still is in some platforms) the most used way to light environments. You can use it to blend between textures, you can use it as a color overlay (you can create color variations on the same texture, as you can see in Mino's tutorial.), you can do a lot with it.
  • Tickwomp
    Offline / Send Message
    Tickwomp polycounter lvl 7
    Does it only apply that value at the vertex? I'm assuming it interpolates the values between the vertices then?
  • fatihG_
    Offline / Send Message
    fatihG_ polycounter lvl 14
    Yes. If you have a quad, the left vertices being black and the one on the right being white than you will have a black to white gradient.
  • Tickwomp
    Offline / Send Message
    Tickwomp polycounter lvl 7
    Then, is the detail/resolution of the blending directly related to how many verts you have on the mesh?

    So if i want more detail using vertex colors to influence things, do i have to have more verts on the mesh?

    Thanks for the replies guys
  • fatihG_
    Offline / Send Message
    fatihG_ polycounter lvl 14
    Pretty much. I think Z brush actually uses vertex colors when painting on the models. Since the Meshes in Z brush are pretty dense, you wont see any obvious interpolating.

    If you use Zbrush. Give it a try on low poly models and than High poly ones.
    Im not 100% about all of this as I use Mudbox.
  • passerby
    Offline / Send Message
    passerby polycounter lvl 12
    Tickwomp wrote: »
    Then, is the detail/resolution of the blending directly related to how many verts you have on the mesh?

    So if i want more detail using vertex colors to influence things, do i have to have more verts on the mesh?

    Thanks for the replies guys

    kinda most poeple who use it for blending between textures will also have a mask texture, too so it dosnt blend with a perfect gradient.

    if your interested i cna show you a shader network that does this to blend moss over brick, where im useing my heightmap as a mask so it fills in the cracks before everythign else.

    because of the interpolation most people will use some sort of mask to control how it blends in, or they will use it very subtly for co lour variation.

    it also helps to consider if you want to do this kinda material ass you make your assets too, that way you can tessellate the mesh to give enough verts to hold the data you want.
  • Tickwomp
    Offline / Send Message
    Tickwomp polycounter lvl 7
    yes, i'm all for examples!
  • passerby
    Offline / Send Message
    passerby polycounter lvl 12
    k tonight i will find the shader i made doing this and take some screens + a little write up for you.

    i took it a bit farther and use 2 vert colours with my, useing the red channel, to blend between 2 texture, and using the green channel to effect how hard or soft the transition is.
  • Computron
  • passerby
    Offline / Send Message
    passerby polycounter lvl 12
    will still do a vid or a outline on what i do but this here is more or less the exact method i use for masked vertex blend materials.

    http://www.laurenscorijn.com/vertex-blending-snow.html

    i just tend to push it a bit farther by having it deadon the original normals and blend between 2 detail normals along with all the other textures it is blending.

    also a other thing i do, because vertex colour can be stored be mesh instance in UDK i iwll use it for darkening or brighting up different modular pieces, and sometimes use a mask for that too, makes things like wall panels look way less repetitive when you can darken up or lighten some of the meshes.
  • Tickwomp
    Offline / Send Message
    Tickwomp polycounter lvl 7
    awesome, thanks. Finally wrapping my head around this stuff.
Sign In or Register to comment.