Home Technical Talk

Texturing, Materials, and Game Performance Question

polycounter lvl 5
Offline / Send Message
SpiffyMai polycounter lvl 5
Hi people!

So, I was trained at a university and majored in Game Development, with an emphasis on 3D Modeling. At that university, they told us things about keeping our polycount small because it can make the game run slowly. We also packed lots of things into one texture, as well. They didn't really go into the specifics of what's more expensive on game performance in terms of textures and materials (except that alphas were pretty expensive). They mentioned "draw calls," but not how they were calculated or even how to keep them down--just Less is Better.

Well, now I have a job, and it's not exactly in games, but we're using Unity and it might as well be a game. I noticed that the way they do their models, textures, and materials is different from how I was taught (although I never took environment modeling). They've also been having some problems with their frame rates dropping significantly and I thought it might have something to do with how they set up their models and materials.

So for one thing, their models happen to be crazy dense because they need to have all the important screws and things, every cylinder is like 20+ sides, and they model most indentions and.... er.. extrusions? On some of the smaller things like rivets and smaller screws they may not model them, but instead use them like decals, placing them all over the model and referring back to a whole texture just for those. Plus decals for things like type, etc.

But then for their textures, they don't use any maps. They'll just use an color value for albedo, a detail image overlayed for some scuff, and then an AO to give it some shading. But since they have soooooooo many pieces (because lots of things become individual items with their own textures), sometimes they end up with like a bajillion materials.

For instance: I was looking at a model for a printer they did. They modeled the printer an then put decals on the tops, anywhere there were buttons that needed type and all the ports, etc. (But they would model the shit out of the buttons.) They would texture those on a texture and material, then use another material for the basic black printer color. So you have one object now with two materials, one including an actual texture map. Would it not be cheaper to just have one material and paint an albedo for it? I do understand that you could get better resolution for the type by doing it this way.

So I asked them what they wanted me to do with the models I was assigned. They told me to just do it however I would normally do it. They said they don't really use normal maps, either, but are interested in seeing what I'll do with what I'm given. But I don't want to be that asshole who makes something and it ends up being more expensive game performance wise than their status quo.  I mean if it were up to me, I'd probably reduce a lot of what they've done to flat planes and throw on a normal to do things like the buttons and some of the fancy inset stuff that doesn't really change the silhouette much. But honestly I'm not sure that I won't be adding to their issues.

Help?

Replies

  • DavidCruz
    Options
    Offline / Send Message
    DavidCruz interpolator
    I suggested a "change" to how things where done to sort out issues that might be these very things and a few weeks later i was "fired/let go"... they threw money or at least the main boss threw money at me and i enjoyed it i declined the funds but it didn't hit me as to why he was doing that the 2nd in "command", must have influenced the "change in direction", since they disliked my "relationship" with the boss, i usually get close and friendly which i thought you should and it remains till this day as such.

    But i would just mimic what they are doing, either before or after i would say hey if you know if you want things to run more smoothly i'd do things like this and this is why.
    As you say, lower the count and project a high detail map on the objects and they can be "cloned" and placed making things run more smoothly and efficiently.

    That is my .02's you decide i brought an experience i went through that sort of clones this one and i suggested something I also suggested now it is up to you to decide what is best for you and them.

    Good luck.
  • radiancef0rge
    Options
    Offline / Send Message
    radiancef0rge ngon master

    What is “bad” for performance really depends on what kind of game you are making. For example open world games with lots of streaming deal tend to have a separate set of limitations than a more predictable linear title.


    That being said there are things to look out for that are generically not optimal for the GPU/CPU and there are few things you can look out for.


    Draw Calls - simply a command dispatched to the GPU to render a mesh. For each material assigned to a mesh this is a separate draw. If the CPU can’t dispatch to the GPU fast enough because there are too many draw calls this causes the GPU to be starved.

    Solution - render fewer meshes, use fewer materials ids.


    Geometry - on modern hardware geometry is mainly a memory problem and not so much a GPU problem. However the density of small, long thin, and fan geometry can cause a problem for the GPU. If you switch to a wireframe viewmode and there are lots of opaque areas on the screen, that's a legitimate problem for the GPU.

    Solution  - pay attention to the density of triangles and ensure that your LODs are efficient. Use few triangles for memory conservation. Ensure instancing of meshes is working.


    Textures - in most cases are a memory problem. High resolution or poorly compressed textures increase disk size and make streaming less efficient. (There are other shader specific problems with textures.)

    Solution - optimize your textures. Pack grayscale textures into red, green, blue, alpha channels to reduce the number of them. Compress with more aggressive methods like DXT. Lower the resolution of texture flats, remember that not all textures in a set need to be the same resolution. Avoid packing non relevant assets with each other.


    Overdraw - happens when a pixel is drawn multiple times by the GPU. Transparency is the main culprit here every pixel overlapped by alpha is drawn at least twice.

    Solution - reduce alpha, decals, fx, and overlapping of those elements to reduce overdraw. Aim for an alpha pass of under 2 ms(?).


    Shaders  - can get bloated very quickly. Math or ALU operations are usually not a huge culprit these days but the number of texture fetches can cause a problem especially if it's asking for huge textures.

    Solution - if you are authoring your own shaders avoid over complication of features. There is a fair amount of nuance to optimizing shaders on a low level if you think there is a problem notify your engineers and hopefully they can take a deep dive on debugging.


    Shadows - can be very expensive (if they are dynamic and not baked) as they have to evaluate the scene from their perspective and then project them onto the scene in relation to the camera’s perspective.

    Solution  - never use point light shadows, reduce shadow resolution, use less shadowed lights, make sure your LODs are efficient, fade dynamic shadows at a distance.


    So for one thing, their models happen to be crazy dense because they need to have all the important screws and things..


    This is difficult to visualize but it sounds inefficient, non silhouette geometry modifications can typically be handled by normal maps. A scenario where modeling in screws and bolts as a necessity is probably hard to come by. A single texture with one screw is inefficient. If this is the method chosen for stylistic purposes try making an atlas texture with all the screws on one sheet.


    For instance: I was looking at a model for a printer they did..


    Hard to visualize but unless this is a stylistic choice this sounds inefficient. Excessive amounts of decals can cause serious overdraw problems. Typically a bespoke asset with a proper normal map has the opportunity to look “better.”


    So I asked them what they wanted me to do with the models I was assigned..


    Try it and see what happens, a single asset in this case is not typically going to cause or reduce performance problems, you’d need to make larger changes. I can’t say that I have personally experienced anything like the above, but it sounds fairly costly if this was a widespread approach to asset generation. I can see a scenario where for a minimalistic art style some of these decisions are well intentioned. Side note: debugging performance without sitting in front of the scene is basically impossible so you may have to do some digging if this is something you are actually interested in. Take a look at this excellent resource simonschreibt.de/gat/renderhell/ and read your engine’s documentation on performance debugging to see the tools they offer.


  • radiancef0rge
    Options
    Offline / Send Message
    radiancef0rge ngon master
    I guess I failed to address the political climate here. Its all about how you approach the situation and what you say. Use common sense, ask questions but don't be condescending as you never know what the reasoning behind what decisions were made. If I understand correctly they asked you to give it a try using another method, so they are open to hearing other workflows.
  • SpiffyMai
    Options
    Offline / Send Message
    SpiffyMai polycounter lvl 5
    Hey guys. First I want to say thank you for replying. You've both definitely helped and given me a lot more to consider, especially if I intend to bring it up to them. I may wait a little while. Since I'm new, they're not exactly sure "What I can do" so they've given me this little project. Like I said, I don't want to be the dick who makes things more expensive but insists its better. So it's nice to have something that helps me to specifically weed things out and then back it up with legit info so they don't think I'm talking out of my ass. Haha. So thanks, radiancef0rge. I'll definitely look at that link. 

    To clarify for shits and giggles: 

    The thing about the screws--some of them are a little necessary because we have to take things apart. We will be looking at some of the smaller things up close--like taking panels off a wall and making the user dig around. But I think they need to invest time in LOD-ing their stuff because sometimes they bring assets in as props, but they are still the very high poly version. 

    I'm pretty sure they do use a texture atlas for decal screws. The question then becomes whether or not they're using one material and applying it to all those decals, or whether or not they use a separate material for each one. I haven't looked at their scenes, so I can't say. 

    I'm not sure that they even have an engineer who could look at this stuff and know what's going on. I know of a couple of good programmers who know that it's the graphics side of the project that's blowing out the performance and I got to see how they know--through the Profiler in Unity. They're pretty much very new at this whole game-style simulation thing. Which is why if I think there's a better way to do something that will help bring their performance issue down, then I want to tell them. But I want to make sure that if that's what I tell them, I don't end up making it worse. Since school never broke it down for me, I wasn't even sure where to look. I've read some things online about the texture atlasing and the polys vs textures but it didn't really clear anything up. Haha. But thanks for the reading material! 

    I appreciate it a lot! 
Sign In or Register to comment.