Home Technical Talk

How to display the "correct" vertcount?

When it comes to optimizing game assets I've learned (from articles like this one: http://www.ericchadwick.com/examples/provost/byf2.html) that it´s the number of vertices that's important rather than the polycount and that the number of uvs and vertex normals affect the total vertcount.
My question is if anyone know a good way to find out the exact vertcount of a model as Maya only display the "original" vertcount, not the effects of uvs and normals?
I'm currently working with XNA and use .fbx file format. Is there a way to get vertcount information by exporting as fbx ascii? I'm not able to make much sense of such a file due to lack of technical skill but I suspect that the information is there somewhere.
Any ideas on how to go about?

Replies

  • Eric Chadwick
    Options
    Offline / Send Message
    MoP did a mel script for this, maybe he can share it, or give you some more info about how he made it.
    http://boards.polycount.net/showthread.php?p=934301#post934301
  • Eric Chadwick
    Options
    Offline / Send Message
    You need a mel script, but there's also a maxscript here...
    http://wiki.polycount.net/Polygon_Count
  • sama.van
    Options
    Offline / Send Message
    sama.van polycounter lvl 14
    I also did some Test under Unity last year with a cube and different Uvs configuration :


    Test_TriangleStrip_Cube_A001.jpg


    But really one more time, this kind of optimization is very difficult to estimate.

    To create a script it returns Uvs Border and vertex with no soft normal info and then to separate vertex they are affected in multi vertex giving a vertex count is probably possible...

    ... but to deduce from a stripping algo what vertex will be divide or not is a very difficult part. (depending of the programmer algo work)

    Also epend of your exporter... Importer in your engine... etc...


    Just make good uvs reducing the number of border edges...
    Use hard edge when you need....
    And after that... it should be ok....


    The documentation your read is first to understand how it works and how an artist can improve in creating 3D...


    Also your 3D will get involved in many tools, then all depend of the work of each programmer on each tools.


    In France I know a stupid game...
    Take 10 persons, speak to hear of the first guy, and he will also repeat your words to the next guy etc...
    And ask to the last guy to repeat the main subject...
    3D is often same....

    You work in Maya (Made in Alias and Autodesk)... export with FBX (Made in Autodesk to communicate between Autodesk product) ... Import in XNA (Made in Microsoft)...

    Then I do not know if they use the same algo for the strip... but....
  • o2_is_alright
    Options
    Offline / Send Message
    Thanks for your replies. I've talked to MoP about the MEL but he didnt seam to remember doing it or there was a misunderstanding, maybe I didnt explain well.

    I've understood too that theres not much use to get caught in numbers when optimizing as long as you use common sense and make sensible choices when working on your model. The reason why I need this though is for my degree project and my plan was to use the vertcount as a way to measure the effects of the optimizations I've made.

    I'm a bit confused here, sorry... but this seams to be a lot more complicated than what I thought at first. Some people referred this to "vertcount before and after transformations" which made me think that it was something that "happened" in the GPU, then I heard that it sort of happens when you export a model from your for instance Maya.
    What I dont understand is how the vertcount can change depending on game engine and what tools you use... Isn't the vertcount constant?

    I might have gotten this all wrong, and if so then I'd appreciate if someone could explain it to me
  • pior
    Options
    Online / Send Message
    pior grand marshal polycounter
    I think its safe to go for the same old answer : dont worry about such complicated calcultions, simply go for common sense and dont be wasteful of either time or energy...
    (just noticed your last post - so yeah i agree)

    As for different engines ... I would think it all depends on their specific optimization choices. For instance, it used to be impossible to export custom normals to unreal 2.5, since the engine/editor recalculated at import. I am sure there was some kind of optimisation reason behind this.

    Good luck for your project! - another piece of data for you would be the unreal3 optimization Kevin was doing on the environments. He mentionned that being anal on the tricount only brought a marginal fps increase - meaning that when it comes to optimization, its all about spending time on what really matters...

    What I like the most when it comes to optim is to cut out pieces of the model that I know can be straighten out in the UVs (surrounding them by a clean line of edges) to ensure super clean mipmapping and clean edge lines in the texture. More of a visual approach than a 'by the numbers' approach, I find it to work very well.
  • o2_is_alright
    Options
    Offline / Send Message
    Just want to get this straight, does the number of vertices vary depending on how you export your model? Say if you would use a custom exporting tool or, as in my case, export them as fbx or obj?
    Pior what you said about unreal 2.5 that it recalculates the model at import makes sense to me now, thanks.
    For my project I'll be doing a comparison of a model from before and after it's been optimized and I was planning to use the vertcount as a variable in that analysis so what I'm after is really a way to get hold of that number.

    So if anybody has, or know where I can find, a vert counting MEL script I'd really appreciate it.
  • sama.van
    Options
    Offline / Send Message
    sama.van polycounter lvl 14
    So if anybody has, or know where I can find, a vert counting MEL script I'd really appreciate it.


    The right vertex count is written in the top left of your viewport in Maya.

    If you want a vertex count as mel script, you need to list the specification of your exporter or engine.

    It works like that and not like you would like it works.
  • o2_is_alright
    Options
    Offline / Send Message
    Well thats just the problem, that the vertcount shown in Mayas heads up display isn't *correct*. From what I understand a vertex, when exported, can only store one value when it comes to uvs and vertex normals so if the vertex is part of a hard edge or has more than one uv-coordinate then it will "split" into a new vertex. In that way the vertcount can end up being a lot higher then is originally shown in Maya.

    I tried out the MaxScript and got it working but I've no experience with 3ds and I ran into some issues with the normals. The script didn't seem to care whether an edge was hard or soft although it's supposed to. I guess that has something to do with the export/import?
  • Eric Chadwick
    Options
    Offline / Send Message
    It used to work with hard edges, back when I used it. I think that was way back in Max v5 (2005 or so). Upgrades to maxscript since it was written could have changed the method, rendering that part of the script useless.
  • sama.van
    Options
    Offline / Send Message
    sama.van polycounter lvl 14
    ok... lets try another way...


    I am playing to create a directX exporter under Maya and I think I got new information.

    About directX in the export file, vertex count seems to change depending of the Uvs.


    For exemple to build a geometry WITHOUT uvs, you will only need to list vertex and then to list the triangle with the connection on each vertex.... something like that :

    (exporter from Maya with my script)
     	Mesh
    	{
    		5;
    		-4.04; -0.36; -4.04;,
    		-4.04; -0.36; 4.04;,
    		4.04; -0.36; 4.04;,
    		4.04; -0.36; -4.04;,
    		0.00; 19.98; 0.00;;
    		4;
    		3; 0, 1, 4;,
    		3; 1, 2, 4;,
    		3; 2, 3, 4;,
    		3; 3, 0, 4;;
            }
    


    This object is a simple pyramid of 4 sides with no bottom face and UVs

    You can read : 5 vertex and 4 triangles.



    No lets export similar pyramid from 3dsmax (yeah 3dsmax because my script do not export uvs yet... :D)
    Uvs are done with flatten tools, and there are 4 triangles separated in the Uv map editor.
     Mesh  {
      12;
      0.000000;24.238159;0.000000;,
      -10.000000;0.000000;-10.000000;,
      10.000000;0.000000;-10.000000;,
      10.000000;0.000000;10.000000;,
      -10.000000;0.000000;10.000000;,
      0.000000;24.238159;0.000000;,
      10.000000;0.000000;-10.000000;,
      0.000000;24.238159;0.000000;,
      10.000000;0.000000;10.000000;,
      0.000000;24.238159;0.000000;,
      -10.000000;0.000000;-10.000000;,
      -10.000000;0.000000;10.000000;;
      4;
      3;0,2,1;,
      3;5,3,6;,
      3;7,4,8;,
      3;9,10,11;;
      MeshTextureCoords  {
       12;
       0.990000;0.794927;,
       0.517180;0.599855;,
       0.517180;0.990000;,
       0.517180;0.565495;,
       0.010000;0.565495;,
       0.990000;0.370422;,
       0.517180;0.175350;,
       0.482820;0.370422;,
       0.010000;0.175350;,
       0.482820;0.794927;,
       0.010000;0.990000;,
       0.010000;0.599855;;
      }
    }
    

    Now you can read 12 vertex, 4 triangle and 12 uvs.



    And then 3rd test using the unfold mapping in 3dsmax :
     Mesh  {
      8;
      0.000000;24.238159;0.000000;,
      -10.000000;0.000000;-10.000000;,
      10.000000;0.000000;-10.000000;,
      10.000000;0.000000;10.000000;,
      -10.000000;0.000000;10.000000;,
      10.000000;0.000000;10.000000;,
      -10.000000;0.000000;-10.000000;,
      -10.000000;0.000000;10.000000;;
      4;
      3;0,2,1;,
      3;0,3,2;,
      3;0,4,5;,
      3;0,6,7;;
      MeshTextureCoords  {
       8;
       0.521710;0.496770;,
       0.329784;1.000000;,
       0.713636;1.000000;,
       1.000000;0.744387;,
       0.043420;0.744387;,
       0.000000;0.362999;,
       0.329784;1.000000;,
       0.043420;0.744387;;
      }
    

    Result : 8 vertex, 4 triangle and 8 Uvs...


    ======================================


    Now my conclusion could be the "Uvs count" of Maya could help you understanding better the vertex count when exporting...

    I am not 100% sure about it, but it could be answer....
Sign In or Register to comment.