Search Unity

problems using additionalVertexStreams

Discussion in 'Scripting' started by Wesley_Yeo, Mar 9, 2015.

  1. Wesley_Yeo

    Wesley_Yeo

    Joined:
    Apr 28, 2014
    Posts:
    3
    Hi, having problems using the new additionVertexStreams, it doesnt seem to be sending any data down to my surface shaders, pretty sure my shaders are working. Here is a snippet of my code.

    Code (csharp):
    1. mf = GetComponent<MeshFilter>();
    2.         if(mf != null){
    3.             Vector2 [] testUV = new Vector2[mf.sharedMesh.vertexCount];
    4.             for(int i = 0; i < mf.sharedMesh.vertexCount; ++i){
    5.                 testUV[i] = new Vector2(1.0f, 1.0f);
    6.             }
    7.             //mf.mesh.uv3 = testUV;
    8.            
    9.             testRenderer = GetComponent<MeshRenderer>();
    10.             Mesh testMesh = new Mesh();
    11.             testMesh.vertices = mf.sharedMesh.vertices;
    12.             testMesh.uv3 = testUV;
    13.             testRenderer.additionalVertexStreams = testMesh;
    14.         }
    15.  
    currently displaying the UVs as color to confirm data values, displays correct values when I uncomment mf.mesh.uv3, but nothing appears otherwise which means data is not being sent down with the vertex streams. would be great if anyone can point me in the right direction.
     
  2. Wesley_Yeo

    Wesley_Yeo

    Joined:
    Apr 28, 2014
    Posts:
    3
  3. MaxRoetzler

    MaxRoetzler

    Joined:
    Jan 3, 2010
    Posts:
    136
    2017.2 and I'm pretty sure this feature is still broken.

    Edit Mode
    Changes applied to the vertexStream mesh get reset instantly.

    Runtime
    Using static batching, the combined mesh only renders one of all combined meshes.

    The vertex stream mesh is also not serialized in the mesh renderer component, which eliminate the need to another component to save the mesh...
     
    Last edited: Oct 23, 2017