Results 1 to 22 of 22
  1. #1
    MSgt. Shooter Person
    Join Date
    Apr 2012
    Posts
    141

    Question Mesh Optimisation

    I've read a metric ton of stuff on the subject, but there's still a bunch of stuff I'm confused about, specifically with regards to Unreal.

    I'm trying to UV my mesh, It's kinda tough with Blender as it likes to put out very crooked unwraps and I need parts of the texture to repeat with vertex for vertex precision. I'm wondering is this a good approach? I'm confused as to where UV "splits" occur. So I'm looking to any of you optimisation pros for sound advise.

    1. Are more UV islands more expensive? Would a single UV island that extends beyond the limits of the texture be more efficient for repeating than multiple that are overlaid inside the UV?

    2. I'm considering as an alternative to use 2 different textures/materials. Can you do two (diffuse) textures in one material? Would that be cheaper than two materials at all? Do two materials matter if the material split is along the same edge loops as a smoothing split?

    3. Is using a bevel really cheaper than using smoothing splits? If the reason smoothing groups are more expensive is that doubled vertices are created, wouldn't a bevel give you the exact same final vert count?

    4. Given a vert count of about 4000 (unreal count, not blender) would removing backfaces that are rarely seen make any (real) difference, or is it more important to minimize material/smoothing splits?

    Exactly how is a new draw call created by an asset, smoothing? Textures? Materials? UV islands? multiple uv layouts? Sub-objects? and how expensive is that, is it more important to have less verts, or less draw calls?

    EDIT: I seem to notice some unwrapped vertices don't "weld" while others do, even within the same island. Does this matter?

    Thank you for your time.
    Last edited by BmB23; 04-17-2012 at 07:12 PM.

  2. #2
    MSgt. Shooter Person
    Join Date
    Nov 2009
    Location
    Austin, TX
    Posts
    209
    Gamer IDs

    Gamertag: ST Omega

    Default

    Quote Originally Posted by BmB23 View Post
    I've read a metric ton of stuff on the subject, but there's still a bunch of stuff I'm confused about, specifically with regards to Unreal.

    I'm trying to UV my mesh, It's kinda tough with Blender as it likes to put out very crooked unwraps and I need parts of the texture to repeat with vertex for vertex precision. I'm wondering is this a good approach? I'm confused as to where UV "splits" occur. So I'm looking to any of you optimisation pros for sound advise.

    1. Are more UV islands more expensive? Would a single UV island that extends beyond the limits of the texture be more efficient for repeating than multiple that are overlaid inside the UV?

    2. I'm considering as an alternative to use 2 different textures/materials. Can you do two (diffuse) textures in one material? Would that be cheaper than two materials at all? Do two materials matter if the material split is along the same edge loops as a smoothing split?

    3. Is using a bevel really cheaper than using smoothing splits? If the reason smoothing groups are more expensive is that doubled vertices are created, wouldn't a bevel give you the exact same final vert count?

    4. Given a vert count of about 4000 (unreal count, not blender) would removing backfaces that are rarely seen make any (real) difference, or is it more important to minimize material/smoothing splits?

    Exactly how is a new draw call created by an asset, smoothing? Textures? Materials? UV islands? multiple uv layouts? Sub-objects? and how expensive is that, is it more important to have less verts, or less draw calls?

    EDIT: I seem to notice some unwrapped vertices don't "weld" while others do, even within the same island. Does this matter?

    Thank you for your time.
    1- this doesn't matter; UVing has to do with quality of textures, lightmaps (texel density) not your frame rate

    2- using multiple materials per static mesh increases draw calls- try to use one material per mesh if possible; you can do 2 mats per mesh for important hero meshes, but keep it to a minimum

    3- beveling edges is cheap, effective, and reads better with lights and materials, plus it makes better silhouettes. This won't affect performance almost at all; so long as you don't go crazy with it

    4- don't ever render back faces unless you absolutely have to- this is one of the simplest and easiest optimizations you can make- not even sure why we're discussing this?

    5- draw calls are made for several reasons, but the most important ones you want to concern yourself with is a) number of unique meshes and b) number of unique materials
    a) having 1000 static meshes of the same instance is cheaper then rendering 1000 unique meshes that are all different- even if they all use the same material! this is a huge (and common) performance hogger
    b) everytime Unreal has to draw a material; there goes a draw call. Try to reuse materials whenever possible, even on different objects (i.e. when making tileable natural meshes or tech pieces for man made stuff); also try to use one material per mesh, as making an object have 3 materials means 4 draw calls (1 for the mesh and 3 more for the materials)

    It's more important to have less draw calls; don't worry about polys too much; Unreal and most hardware (including XBox360 and PS3) and most PC's can handle tons of polys with little hit to framerate- draw call will get you however; particularly on the GPU- so keep those number of materials and unique meshes in check!

    As for your last Edit question, honestly have no idea what you're referring to.
    Environment Artist
    Certain Affinity

  3. #3
    MSgt. Shooter Person
    Join Date
    Apr 2012
    Posts
    141

    Default

    That doesn't really tell me anything I didn't already knew. It's very vague, and you're fairly inconsistent too; are polies irrelevant as in answer 5c or do they count enough that I absolutely need to manually cull every single backface as in answer 4? Since UDK handles backface culling automatically this is basically a non-issue. What I meant was removing backfacing vertices. Not whether it would make a difference, but whether it would make a *real*(noticable) difference.

    But what I mean with the last question is, in Blender, some UV vertices are connected to all surrounding vertices, others are actually two or more vertices overlaid. Same as in 3D when you get vertex doubling.

  4. #4
    MSgt. Shooter Person
    Join Date
    Nov 2009
    Location
    Austin, TX
    Posts
    209
    Gamer IDs

    Gamertag: ST Omega

    Default

    Since I can't tell you anything you don't already know, there's no point in sharing anymore info with ya
    Environment Artist
    Certain Affinity

  5. #5
    MSgt. Shooter Person
    Join Date
    Apr 2012
    Posts
    141

    Default

    Don't get me wrong, I came here as a last resort, Google was my first friend. And you just didn't clear anything up at all, I'm still confused how exactly Unreal handles all this stuff. Like, I want to be able to look at a mesh and say "unreal will create this many draw calls" and your answer just didn't help me do that.
    Last edited by BmB23; 04-18-2012 at 11:08 AM.

  6. #6
    MSgt. Shooter Person
    Join Date
    Apr 2011
    Posts
    175

    Default

    Quote Originally Posted by BmB23 View Post
    I've read a metric ton of stuff on the subject, but there's still a bunch of stuff I'm confused about, specifically with regards to Unreal.

    I'm trying to UV my mesh, It's kinda tough with Blender as it likes to put out very crooked unwraps and I need parts of the texture to repeat with vertex for vertex precision. I'm wondering is this a good approach? I'm confused as to where UV "splits" occur. So I'm looking to any of you optimisation pros for sound advise.

    1. Are more UV islands more expensive? Would a single UV island that extends beyond the limits of the texture be more efficient for repeating than multiple that are overlaid inside the UV?

    No, this doesn't matter at all. As long as it is a single texture lookup (and it is) performance is exactly the same.

    2. I'm considering as an alternative to use 2 different textures/materials. Can you do two (diffuse) textures in one material? Would that be cheaper than two materials at all? Do two materials matter if the material split is along the same edge loops as a smoothing split?

    Anything is cheaper than 2 materials. Having smoothing groups split at material split is irrelevant.

    3. Is using a bevel really cheaper than using smoothing splits? If the reason smoothing groups are more expensive is that doubled vertices are created, wouldn't a bevel give you the exact same final vert count?

    No, this is false. Bevel creates more triangles, whereas a smoothing group split is the same triangle count. Chances are, you will make a smoothing group split even when you DO have a bevel in there, unless you want a perfectly smooth surface, in which case why do a smoothing group split in the first place?

    4. Given a vert count of about 4000 (unreal count, not blender) would removing backfaces that are rarely seen make any (real) difference, or is it more important to minimize material/smoothing splits?

    I am not sure if you understand the meaning of backfaces. Backfaces are, well, the backs of triangles. They are culled by default ( = not rendered). The only time you would want to force to render them is when you want a two-sided material, like glass. It is fairly cheap btw. Having fewer materials is more important. Smoothing groups - don't matter at all (well they do increase the number of render batches (which do not equal draw calls btw), but trying to decrease that for optimization purposes is really overdoing it).

    Exactly how is a new draw call created by an asset, smoothing? Textures? Materials? UV islands? multiple uv layouts? Sub-objects? and how expensive is that, is it more important to have less verts, or less draw calls?

    This is hard to explain, but basically there are draw calls, and inside a single draw call, there are render batches. For all triangles that form a continous, unsplit surface, they go into a single render batch. Smoothing groups stop this. So for all smoothing groups, there are individual render batches. These are however are still within one draw call.
    A new draw call only happens when 2 triangles do not share the same material/shader. Each material/shader has common settings like light vector, camera vector, world position etc. They are all the same, you cannot change them. You CAN change however other things. The way light is handled (whether it is simply Phong, or some other light equation), the texture that gets applied etc. So in essence any new material equals a new draw call. This is why it is important to only have a single material per object, because in that case the entire object can go into a single draw call.


    EDIT: I seem to notice some unwrapped vertices don't "weld" while others do, even within the same island. Does this matter? Performance wise they don't matter. You might experience "cracks" in the texture though.

    Thank you for your time.
    Answers in the quote.

  7. #7
    MSgt. Shooter Person
    Join Date
    Apr 2012
    Posts
    141

    Default

    Alright, that is very enlightening. So two materials create 2 draw calls no matter what? And this is quite expensive compared to just two batches of smoothing? And Unreal has no way of making two different (diffuse) textures use the same material, in case I wanted to use that to map it out with less waste space in the UV map? I'm guessing this is why texture atlases can improve performance by grouping several unique meshes into one material draw call?

    And UV splits don't matter at all, I could have every face in its own island and it would be all the same? (Harder to paint texture obviously. )

    Finally, what I meant with "backfaces" was, the mesh would usually be seen only from one angle, and the backfaces would only show up in maybe cinematics. So while Unreal handles culling the faces, it still has to process the vertices of those unseen faces. Would it be worth it at all to create a seperate mesh without those vertices? Could maybe save a very marginal amount of texture space too. (Quite marginal, the unseen part takes up only a small amount of the UV space.)

    Just making sure I understand all this correctly, hope it helps anyone who sees the thread too. You've been very helpful.

  8. #8
    MSgt. Shooter Person
    Join Date
    Apr 2011
    Posts
    175

    Default

    Yes, 2 materials create 2 draw calls no matter what. And yes, it is more expensive than just two batches of smoothing. You have a good point with texture atlases. That is the only way to have more than 1 diffuse texture in the same material.

    UV splits don't matter at all. Seriously, you could have every face a single UV island and it would still perform the same.

    As for backfaces. Don't worry about them. They don't create extra vertices, trust me. The only way to make backfaces eat up additional resources is to deliberately create them in your modeling package. But then again, they won't be backfaces anymore, simply a normal face, facing the other way.

  9. #9
    MSgt. Shooter Person
    Join Date
    Apr 2012
    Posts
    141

    Default

    That's what I mean, the vertices that are "behind" the object's usual orientation, not usually seen. Not as in the backside of the normal of the face. I know that is auto-culled.

    Like, if you have a house in the background and it'll always be seen from the same side barring a few special cases, then the walls facing away from the play area are "behind" or "backfaced" if you will.

  10. #10
    MSgt. Shooter Person
    Join Date
    Apr 2011
    Posts
    175

    Default

    Ahh, well those are not called backfaces, this is where the misunderstanding comes from Of course it is very adviseable to delete those. Like a house for example. If you know it will only ever be looked at from the front, they why model anything else than the facade? Anything else, like the sides, the backs, the interior would just consume additional resources whileas they will never be seen.

  11. #11
    MSgt. Shooter Person
    Join Date
    Apr 2012
    Posts
    141

    Default

    Well some additional resources, but would it even be noticable given a vert count at say 4000? It'd be nicer to just have a single mesh for all cases.

  12. #12
    MSgt. Shooter Person
    Join Date
    Dec 2007
    Posts
    286

    Default

    pr0tip - weld your UV verts using the weldSelected tool. disconnected UV verts are the same deal as smoothing splits - there has to be info on each side of the split so its double weight.
    you can tell in max if an island is properly welded, the green seam should only be around the edge of the island, with the middle having only fainter white edge lines.

  13. #13
    MSgt. Shooter Person
    Join Date
    Apr 2012
    Posts
    141

    Default

    I'm using Blender and I'm not sure if it has that kind of tool. Regardless one of you is saying it doesn't matter one bit the other is saying it's super important. Who is right? Really confusing.
    Last edited by BmB23; 04-21-2012 at 12:08 AM.

  14. #14
    MSgt. Shooter Person
    Join Date
    Apr 2012
    Posts
    141

    Default

    So is it important or is it important not?

  15. #15
    MSgt. Shooter Person
    Join Date
    Apr 2011
    Posts
    175

    Default

    What he is saying that split UVs create the same different renderbatch just like smoothing group splits do. He may be right, i honestly don't know. It is always best practice to have as few UV islands as you can anyway. The less seams without stretching, the more visually appealing your final model will be when lit.

  16. #16
    MSgt. Shooter Person
    Join Date
    Apr 2012
    Posts
    141

    Default

    Seams are really a nonissue with projection mapping.

  17. #17

    Default

    Animation is a huge factor when it comes to UV mapping. A character mesh is expected to bend and move, the mesh & texture stretch and move with the skeleton. High detail in the normal map across UV seams in these stretching areas is almost always problematic. For a standard, biped character, A good place to put seams is where the seams are in your clothing. On the underside of the arms, on the inside of the legs, areas that won't very visible when animated (think camera angle). The next best place for UV seams is where material changes are expected. Sleeve ends, hair line, collar, etc. This is also helpful if your character needs a change of clothing (red team, blue team). I use Wings3d and Roadkill for UV-mapping. But as I understand it, Blenders UV-mapping tools were written by the same outfit as Roadkill. Also, Blender likes to split material channels into seperate objects, hense your vertex welding problem. You're better off using a single material for animated objects. I'm just getting started with the UDK myself, but it seems to me that you can use Specularity to show material changes in UDK without having separate materials. Download the "Materials" videos and watch the Specularity one, notice the difference in the brick and the grout. You may have to build a separate specularity texture map, but this would be a better way to go.

  18. #18
    MSgt. Shooter Person
    Join Date
    Apr 2012
    Posts
    141

    Default

    Inside Blender I only have one material.

  19. #19

    Default

    Quote Originally Posted by hunharibo View Post
    This is hard to explain, but basically there are draw calls, and inside a single draw call, there are render batches. For all triangles that form a continous, unsplit surface, they go into a single render batch. Smoothing groups stop this. So for all smoothing groups, there are individual render batches. These are however are still within one draw call.
    A new draw call only happens when 2 triangles do not share the same material/shader. Each material/shader has common settings like light vector, camera vector, world position etc. They are all the same, you cannot change them. You CAN change however other things. The way light is handled (whether it is simply Phong, or some other light equation), the texture that gets applied etc. So in essence any new material equals a new draw call. This is why it is important to only have a single material per object, because in that case the entire object can go into a single draw call.
    What about using the same materials applied over separate static meshes? I'm mapping out a neighborhood (as close as I can to a real neighborhood) and will have quite a few separated static meshes around. (Windows, doors, roof parts, walls, specific walls with cutouts for windows/doors, etc.) I need two white-painted wood textures, two brick textures, and one glass material for the windows. (As well as roof textures and some other stuff.) I'm thinking the best approach is to simply make generic (instead of mesh-specific) materials that can be reused on all houses. Much easier to do this way because I don't need to make specific textures (which do consume more memory) but the fact that each mesh will be calling several materials at once (unless I can pack several textures into one material and pick out which one to use by specific polygons.) means more draw calls even though the fewer materials and textures overall will save memory.

    I assume that's still the best approach though, but I do need to eventually find out how to pack more than one diffuse texture into a material and separate it by polygon instead of by using a mask or whatever. If all goes well, I can use one material for both brick textures, one material for both wood textures, and one material for the glass. I'm also dealing with many houses here as well as large surfaces that demand tiling (and multilayer) textures for good detail. I'm looking for some rich detail in those brick walls! (Though the player is human sized, not ant sized, so I don't need anything too crazy as long as it looks better than the brick walls from Bad Company 2, lol.)

  20. #20
    MSgt. Shooter Person
    Join Date
    Feb 2011
    Posts
    214

    Default

    You will need to research UV layout to "apply textures to certain polygons". Once you're comfortable with that, I recommend cecking out this UDN article:

    http://udn.epicgames.com/Three/MeshProxyTool.html

    With the MeshProxyTool and Simplygon, you can build your buildings out of modular pieces and then "combine" them into a single mesh with a single texture/draw-call. This is used for houses "in the distance" and as part of setting up LOD levels (Simplygon) for your buildings.

  21. #21

    Default

    Not sure where you're going with the UV layout. I've already used UV layouts in previous models, but the problem right now is that I need certain areas of texture to tile. I've heard about texture atlases, but I'm not clear on how practical they are to implement and on whether they allow specific sections of an image to be tiled (X and Y) without interruption.

    Anyway, I will translate the question I have to a simpler one. Take, for instance, a short unit of mesh fence with two textures: the mesh fence itself and the metal pattern of the supporting poles. You can use two separate textures for the two components or combine them into one image, but doing the latter does not allow the mesh fence to tile, but the tile has to be done in the image itself (resulting in a much larger image). The question here, I suppose, is how to avoid two draw calls, or perhaps whether the draw calls matter; if the draw call for each texture happens once for all instances of the object instead of one draw call for each instance, then I don't think it matters at all but this is unlikely the case unless the MeshProxyTool you mentioned is used. A possible alternative is to make the mesh fence itself longer so that each instance covers more fence, but the question boils down to this:

    Can multiple instances of an object using the same material (or perhaps, instance thereof) be combined into one draw call without having to, say, use the proxy tool and reduce their detail? I'm going to assume that the answer is no, which means it would be of advantage to make each mesh fence piece (instance) as long as the level design will allow them to be. (To an extent of course, since it does have to render the entire fence even if part of it isn't visible.)

    As for the houses, perhaps what I really need is to be able to have multiple diffuse textures within a material be called upon by the polygon's material ID. I may also be able to use the same technique used in terrain: have multiple layers of textures and use a mask to show and hide each one, but this requires a lot of additional UV coordinates and looks to be a general pain in the ass overall.

    Maybe I'm just being excessively concerned about the draw calls. In all the tutorials I see, nobody has a problem with using separate materials for the floor, walls, and ceiling of the insides of a building, and since I'm working with large, tiling areas (albeit on the exterior this time), having separate materials really seems to be the way to go.

    I suppose I almost ended up answering my own questions, but some additional insight on all of this would be appreciated. I'll continue to search on it in the meantime. Thanks for the tip on the MeshProxyTool as I will definitely need it in the future when I get to low detail buildings.

  22. #22
    MSgt. Shooter Person
    Join Date
    Apr 2011
    Posts
    175

    Default

    Quote Originally Posted by CA99 View Post
    the question boils down to this:

    Can multiple instances of an object using the same material (or perhaps, instance thereof) be combined into one draw call without having to, say, use the proxy tool and reduce their detail? I'm going to assume that the answer is no, which means it would be of advantage to make each mesh fence piece (instance) as long as the level design will allow them to be. (To an extent of course, since it does have to render the entire fence even if part of it isn't visible.)
    It is possible. In fact, that is what the foliage editor does. In materials you can check the 'used with instancing' checkbox and somehow you can also make your meshes instances of each other and then yes, they WILL go into the same drawcall. Sorry to say though that I lack sufficient knowledge on the matter with UDK I only know that it is possible, in fact EPIC does it with foliage.


 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright ©2009-2011 Epic Games, Inc. All Rights Reserved.
Digital Point modules: Sphinx-based search vBulletin skin by CompletevB.com.