Search Unity

Is there an HDRP version of a Vertex Color shader?

Discussion in 'Shaders' started by AnthonyPaulO, Dec 11, 2019.

  1. AnthonyPaulO

    AnthonyPaulO

    Joined:
    Nov 5, 2010
    Posts:
    110
    The standard one I've been using is https://wiki.unity3d.com/index.php/VertexColor which allows you to assign colors to your vertices instead of a texture map, but although someone mentioned that the HDRP Layered Lit shader should work with colors it doesn't seem to.
     
  2. Invertex

    Invertex

    Joined:
    Nov 7, 2013
    Posts:
    1,550
    Does utilizing the Vertex Color node in ShaderGraph not work for your needs? It can be utilized with any of the HDRP shadergraph shaders, including Unlit and StackLit.
     
  3. AnthonyPaulO

    AnthonyPaulO

    Joined:
    Nov 5, 2010
    Posts:
    110
    It used to be that you could use the Vertex Color Node and simply hook it up to the Albedo, but in HDRP I don't see Albedo (in Lit) so I'm now officially lost.
     
  4. Invertex

    Invertex

    Joined:
    Nov 7, 2013
    Posts:
    1,550
    It's just called "BaseColor" now.
     
  5. AnthonyPaulO

    AnthonyPaulO

    Joined:
    Nov 5, 2010
    Posts:
    110
    Invertex, you're a gawd dayum genius!! Thank you so much! Colors seem washed out though... gonna have to add a multiplier and tweak it, but I'm obviously missing something.
     
  6. Invertex

    Invertex

    Joined:
    Nov 7, 2013
    Posts:
    1,550
    They shouldn't be, sounds more like lighting settings in your scene, unless you're expecting 100% intensity, then use "Unlit" instead of Lit shader and it will be pure color output not affected by lighting.

    If you compare a lit material that has the same color value set on it as you have on a mesh, you should see they'll render looking the same.
     
  7. cchatzakis

    cchatzakis

    Joined:
    Nov 22, 2019
    Posts:
    7

    I had to deal with the same issue. The colors are washed out indeed. That is due to the color space of the project. HDRP works in Linear colour space. So basically you need to convert your vertex colors from gamma to linear.

    Here is my Unlit shader graph. I am no shader expert, but that seems to work well for me. I believe it should work exactly the same with a Lit shader. By all means, use it as you want.
     

    Attached Files:

    BjoUnity3d likes this.