XNA Creators Club Online
Page 1 of 1 (4 items)
Sort Posts: Previous Next

A muddle of meshes

Last post 4/26/2007 4:36 PM by lynch3. 3 replies.
  • 4/26/2007 4:04 AM

    A muddle of meshes

    Hi all.

    My Age of Sail strategy game is coming along gradually, I just wanted to run something past people.

    I have a mesh for the ships hull and a mesh for a sail.

    Currently I render all the ships hulls, then I render all the sails. (at the moment there is only one design of sail, but I will have to make more).

    So if I have 20 ships, each with 9 sails, then the sails will require 180 draw calls. Obviously I have to draw the rest of the scene as well.

    Should I be concerned by that figure?

    Should I be thinking about creating a Mast mesh instead (which would have several sails). (This would be a shame, as I am planning on doing effects on each sail)

    Thanks very much

    J.

    ps..Keep going on your games!

       (don't give up, and don't get disheartened if someone for example says "what are those brown rectangles" about your boats)

    :)

    In playtest Flite
  • 4/26/2007 7:37 AM In reply to

    Re: A muddle of meshes

    Generally, I don't think this will be a problem, and I don't know if combining them into a single mesh would speed things up all that much. It also depends on how complex the meshes are, particularly how many vertexes each mesh has. For example, the models in the Spacewar game have a very large number of vertexes which make them look nice and can scale to large sizes and still look good, but I wouldn't want to use too large a number of them.

    I guess the answer would be, try it out and see how it does, and if you see performance issues come up with a solution later. You may want to run a test with double the maximum amount of ships you ever expect to have on the screen and see if it keeps up ok, so that you don't hit some threshold accidentally if you didn't accurately account for the amount of ships you could have. 

  • 4/26/2007 12:41 PM In reply to

    Re: A muddle of meshes

    There is a certain amount of fixed overhead for each draw call that you issue, which is independent of how many triangles are in that call. For instance if you drew a single mesh containing 10,000 triangles, that would perform fine, but if you drew 10,000 meshes, each with just one triangle, performance would be abysmal!

    A few hundred meshes is probably somewhere on the dividing line. You will probably be fine, but many more than that and you might start to see the per-mesh overhead becoming significant. Really the only way to know is to measure it in the context of your specific game and see what performance you are actually getting.

    XNA Framework Developer - blog - homepage
  • 4/26/2007 4:36 PM In reply to

    Re: A muddle of meshes

    As an example of what Shawn said, my artist handed me a scene with 65,000 polygons.  When I attempted to render the scene I got around 15FPS.  I looked at the scene and noticed he had modeled every machine part of the models he gave me as different meshes making it about 200-300 different objects.  After combining each machine part to make the final object cound around 20 or so the scene rendered at a smooth 60 FPS (vsynced).

    http://www.iequalshane.com/
Page 1 of 1 (4 items) Previous Next