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.
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.
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?
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
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??
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.