Search Unity

Vertex colors: if unused, still increase GPU/CPU load?

Discussion in 'General Graphics' started by marcatore, Apr 15, 2019.

  1. marcatore

    marcatore

    Joined:
    May 22, 2015
    Posts:
    160
    Probably a silly question...I'll try to explain.

    I'd like to use Vertex colors to using inside Substance Painter to create a ColorMap.

    After created the textures (just albedo, normal and roughness...nothing related to vertex deformations ) inside Painter, I'd like to export them and use it on a Unity Standard Shader without involving any kind of vertex deformations or vertex blend and so on.

    So, my question is: if a shader is not using the vertex color data, this data is loaded in any case and the CPU/GPU still computes it or it will be discard immediately as the shader is not using it?
    Using other words, that vertex color data should be deleted before import the model inside Unity or should still in because it will be ignored in any case?

    Thank you in advance clearing my doubts
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,352
    If a shader doesn't use those vertex colors, then the GPU won't read that data, and it won't add any cost to the GPU beyond some minor additional memory usage from the mesh data being uploaded with those vertex colors.

    If you have no prefabs or scenes with your model using a shader that uses vertex colors, then Unity will by default strip the vertex color from that mesh during build time. This means it won't take any memory in the build, or on the CPU, or on the GPU.

    TLDR: It's fine.
     
  3. marcatore

    marcatore

    Joined:
    May 22, 2015
    Posts:
    160
    Thank you very much @bgolus

    Now it's clear. :)