Search Unity

Efficient way to write additional data in TEXTCOORD

Discussion in 'General Graphics' started by RockSPb, Nov 29, 2018.

  1. RockSPb

    RockSPb

    Joined:
    Feb 6, 2015
    Posts:
    112
    Hello!
    We need to write some additioal data in UVs on static geomatry( 2 float3 values).
    I would like to know if there is a way to write data values to static geometry during the build like Unity does for Lightmap UVs?
     
  2. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    4,627
    https://docs.unity3d.com/ScriptReference/Mesh.html

    the mesh class exposes all of the additional uv sets, including some that unity's shaders don't already use, so that you can set them to whatever you want. Also the Vertex colors, which Unity's built-in shaders don't use either.
     
  3. RockSPb

    RockSPb

    Joined:
    Feb 6, 2015
    Posts:
    112
    Thanks! There is no size overhead if we generate arrays offline?
     
  4. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    4,627
    Not sure what you mean by that, but it's possible to write code that runs only in the editor and outputs the modified mesh assets to file. That way, your code does not even need to run during your game's execution.
     
  5. RockSPb

    RockSPb

    Joined:
    Feb 6, 2015
    Posts:
    112
    Nevermind! I did a test. Arrays greatly increase the size of scenes in a project. But the size of the build almost did not increase. I thought it would be a problem.
    Thanks.