Search Unity

Vertex color shader, best way to set a true/false flag per mesh

Discussion in 'Shaders' started by deab, Jun 2, 2015.

  1. deab

    deab

    Joined:
    Aug 11, 2013
    Posts:
    93
    Hi

    I'm using a simple vertex colour shader, and I want to be able to show each mesh in one of two states without breaking batching (for example, full colour or grey scale).

    Currently I'm using the alpha value of Mesh.color32 to trigger the grey scale mode, but I'm setting this for every vertex. Is there a way to read this value once in the sharer and then set a flag?

    Or is there a better way of passing a flag in the Mesh data without having to update for every vertex?