hi
i ve put together a simple unity scene to test out mesh optimization suggested by frame advisor, but i am having trouble figuring out how to fix duplicated vert shown in Frame Advisor. also having trouble with ideal mesh BW.
i m using a simple bg plane mesh exported from maya, ensuring no split vert and all clean
and the test scene looks like this, 1 using Unity legacy standard shader, 4 planes (to the upper right) using custom unlit shader
in frame advisor, all 4 plane to the upper right are being recorded as having 1 duplicated vert in the data
and the one using Unity legacy standard shader, did not have any duplicated vert, its using the same mesh from the same FBX import.
the only diff being the vert attr which presumably are pos, vert col, uv0,uv1 that are being used in the standard shader, are different from the other 4 draws
at first, i was thinking maybe its because of the float4(pos) + float2(uv) in the unlit shader that maybe causing some padding problem? and that s why there is 4 different version of the unlit shader being used in this test scene. each one trying out an maybe idea to fix this duplicated vert issue.
but, clearly they (the ones to the upper right) are still showing 1 dup vert.
and if i was to set the FBX to mesh compression using high in unity, then build
the dup verts now became 4 instead of 1
now i hav no idea as to how to make sense of this data la.
question:
1. can i get an explaination on how the above could be happening? how come legacy standard shader got no dep vert on the same mesh?
2. how can i get rid of this dup vert in custom shader? ( this is the most vital question BTW)
3. how is the ideal mesh bandwidth calculated ? float3 + float2 = 20 bytes, how do we come to 316 bytes ideal BW ?
live.interceptor.zip
since the uploaded unity project, i hav made a few more captures, but it should contain the same data
Thank you very much. We'll take a look and get back to you
Thank you for using Frame Advisor! I've investigated your trace file and will try to answer your questions:1)Although the original model has no split vertices, the draw call with one duplicate vertex uses GL_TRIANGLES created from 30 indices. Based on this, I would expect that there would actually be more than one duplicate vertex. Digging into the raw geometry data, I can see that indeed some other vertices are almost identical. However, the "duplicate vertices" metric looks for byte-exact duplicates, and there's only one instance of this in the data. So somewhere between your Maya model and your app, the geometry was split into triangles in a way that these almost-identical vertices were created. The same is true for the legacy shader call. It may simply be a matter of chance that there are no byte-exact duplicates in this case.
So I can confirm that the data you're seeing in Frame Advisor is accurate, but I'm not able to comment on why the vertex buffers are being built in this way.
As for the mesh compression, I can speculate that the almost-identical vertices described above are being compressed and, consequently, becoming identical.2)Ideally, the vertex buffer shouldn't contain almost-identical vertices. If the vertices are supposed to be identical, they should share their data in the vertex buffer and the index buffer should be used to describe the triangles they form. I can't say how to achieve this in Unity.3)"Ideal mesh bandwidth" calculates the geometry bandwidth for the whole draw call, not just one vertex. It also models the geometry caching behaviour of Mali GPUs, so it's not always easy to reproduce the resulting value by hand.