How to optmize mesh data update in frumstum ?

Mesh parentmesh = new Mesh ();
        parentmesh.SetVertices (newverts);
        parentmesh.SetTriangles( newtriangles,0);

        if(newcolors.Count>0)parentmesh.SetColors (newcolors);
        if(newnormals.Count>0)parentmesh.SetNormals (newnormals);
        if(newvuvs.Count>0)parentmesh.SetUVs (0, newvuvs);
        if(newvuvs2.Count>0)parentmesh.SetUVs (1, newvuvs2);
        if(newvuvs3.Count>0)parentmesh.SetUVs (2, newvuvs3);
        if(newvuvs4.Count>0)parentmesh.SetUVs (3, newvuvs4);
        parentmesh.SetIndices (newindices.ToArray(),MeshTopology.Triangles,0);//this will cause gc,why no list??

Hi all,I test make frustum culling when mesh dynamic add and remove ,but the count is so many,have any method to incread the perpormance?now is 30+ms to update once… my thought is, any collider matching one mesh data, so when in frustum any colliders changed, will send a list mesh data to show.

copy 165528 item to list is too heavy when update mesh data which in frumstum?

nobody?how make your custom frumstum culling?

What is it that you want to achieve with it and why? I don’t understand why you actually modifying the meshes in the update.

edit: If all you want is standard frustum culling than your approach is way to complicated (at least from the little info provided)

  1. Only changed data will update mesh data.like some object visable and disable.
    2.Not so complicated i think ,Only need to increase the update date speed.

why unity update dynamic mesh data more faster ?they caculate data in gpu?Mesh no more channel save the matrix to shader - -

Noby make custum dynamic batching?

I still don’t fully understand what it is that you want to achieve. View frustum culling is almost the opposite from dynamic batching. In view frustum culling you want to have many (or at least a good structured set of) objects, so that you can only render the ones that are actually visible. This usually reduces the amount of vertex data to be processed and also the number of draw calls.

Dynamic batching on the other hand, tries to minimise the number of objects that are rendered (draw calls) with the trade-off that the number of vertices to be processed in increased in the general case.

If the scene looks like the one in your screen shots, why do you want dynamic batching? Maybe static batching plus view frustum culling works as well? How many vertices are you trying to render and what is your target platform?

Static Batching of Unity is good for you. Objects not in the frustum will be culling by a dynamic Index Buffer.

frutum culling is work but performance is so low,this is the same as dynamic batching.when the combine mesh moving with 4W+ vertex ,calculate the new position and rotation is very slow in cpu

No, Unity will not culling the part of mesh was static batched,it will render all one

Unity will cull not visible game objects that are part of the static batching.

https://docs.unity3d.com/Manual/DrawCallBatching.html

if you mean that unity will not cull a part of a visible gameobject then you are correct.

yes

and ,i want use UV3 to save position, UV4 to save rotation.but uv is vector2[ ]…so sad!! Why not use vector4[ ]?? and limited 4 pices uvs to use, shadermode 2.0 is can set 8 pices uvs channels to use,I do not unstand unity why set this limted??

You can use the vertex color if you need a vector3[ ]

why unity more master? it use C++ code to make list and calculate in gpu?

It’s worst to combine all meshes in Update Method. You should do this only once, for example in the Start Method.
You can store index data in Vertex Stream(like tangent), send uniform matrix array to shader, and use the index data(like tangent) to get the correct matrix to transform.

? I only combine once when obj mesh visable and disable…this is update the position and rotation.

the bottleneck is the mesh’s vertexes position and rotation data update,how to optimize about this,unity how faster more?

Nobody help?