Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Packing pairs of input UV-sets to single TEXCOORD?

Discussion in 'Shaders' started by Lex-DRL, Mar 21, 2017.

  1. Lex-DRL

    Lex-DRL

    Joined:
    Oct 10, 2011
    Posts:
    139
    The topic name is self-explaining.

    But if not, here are details:
    right now, Unity sends mesh UVs as separate texcoords. But it seems to be kinda-ineffecient since texcoord can store a 4D-vector while UVs are only 2D. So, in theory, we can use twice as less mesh attributes if we just pack UV-sets in pairs. This will:
    1. Allow as send more uv-sets then we currently can (especially important for old mobile platforms which don't support SM3.0+).
    2. Since dynamic batching is limited by number of vertex attributes in a mesh (not by total number of attributes' components), it could handle more vertices in multi-UV-set cases.

    So, is there a way to pack mesh UV-sets in couples and send them to graphics cards as 4D texcoords?
    So far, I only see "uvN" property of Mesh class, which can take only Vector2. So I can't even rebuild mesh myself.
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,329
  3. Lex-DRL

    Lex-DRL

    Joined:
    Oct 10, 2011
    Posts:
    139
    Thanks. I missed the most obvious place to look for. :oops: