1
$\begingroup$

So i'm back with another stupid question about low-level 3d :D I'm writing addon that will count the number of vertices that is needed to render the mesh say in Unity.

For now i've decided to first count how much normals re there on every visible vertex, so this unique normals would be the number i need.

But UVs add verts too, so i decided to count all the UV verts, subtract number of visible verts and add this number to total count (normals).

That worked fine for simple and complex meshes and i was happy. But now i've created another model and addon failed to count right number.

After investigation a narrowed the issue down to that thingy (see below). It is mesh with smooth shading. Blue - hard edge, orange - uv seam.

My addon shows 13 verts for it and it is right according to its algorythm. But there are 14 verts, because 4 separate polygons would be drawn.

So i'm stuck because i totaly do not know how to get such information from blender api (and actually i don't know what information i need). Anyone familiar with this can advice me something useful?

link to full addon code: https://github.com/curly-brace/Blender-Vertex-Counter

The strange hexagon:

enter image description here

$\endgroup$
-1
$\begingroup$

List of objects in scene with counts (verts, faces, tris)?

I think a suitable solution can be found here. They use a len method which I'm sure might be useful in your case.

$\endgroup$
  • $\begingroup$ len is just a python way to get the size of collection. and this method displays visible verts, the same as displayed by blender on top of the window. $\endgroup$ – curly brace Aug 14 '16 at 8:19
  • $\begingroup$ @curlybrace they end up using it in an addon that refers to the 12 top objects. I'm sure you can pretty much do the samething, but use the active object. $\endgroup$ – TheShadowblast123 Aug 14 '16 at 8:38
  • $\begingroup$ this approach uses a very simple way to count. it does not takes split-normals or uvs into account $\endgroup$ – curly brace Aug 14 '16 at 9:19
  • $\begingroup$ could you check whether or not the vertex is smoothed and/or seamed? because in that case you could use a full list of verts to start, then add to the count for every sharp and seamed vertex I'm too tired to bother (it's 2:45am for me) $\endgroup$ – TheShadowblast123 Aug 14 '16 at 9:44
  • $\begingroup$ i thought about this yesterday, but in this case if edge is seam and sharp in the same time, this algorythm will count it as double separate, but this is wrong. i should somehow look for intersecting hard edges and seems, but it is too complex for me to plan and i even don't know how to build data structure for this and then how to search crossings in it $\endgroup$ – curly brace Aug 14 '16 at 10:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.