Home Unreal Engine

Bunch of technical questions, draw calls realted

Tzur_H
polycounter lvl 9
Offline / Send Message
Tzur_H polycounter lvl 9
Hi guys,

1. Draw calls vs texture res, what to go for?
For example, a mesh with 3 materials, each material is a 1k texture.  Or a mesh with 1 material but 2k map.  Would it be the same case if 3 materials and 2k textures, vs 1 material and 4k texture?

2. LODs: Having multiple LODs = more draw calls?  If I have a mesh with 3 material elements, and 1 LOD, is that 8 draw calls?

3. Does the command "stat scenerendering" shows only mesh draw calls, or is that also including draw calls for material elements?

Thanks!

Replies

  • EliasWick
    Options
    Offline / Send Message
    EliasWick polycounter lvl 9
    Boop* I am curious about some of your questions as well...

    1. You probably know the basics, if not: https://www.youtube.com/watch?v=F5_lUfufSCk
    2. Here is one about materials, but probably not exactly what you are looking for: https://www.youtube.com/watch?v=k-yRzMjzfPM
  • Vailias
    Options
    Offline / Send Message
    Vailias polycounter lvl 18
    Tzur_H said:
    Hi guys,

    1. Draw calls vs texture res, what to go for?
    For example, a mesh with 3 materials, each material is a 1k texture.  Or a mesh with 1 material but 2k map.  Would it be the same case if 3 materials and 2k textures, vs 1 material and 4k texture?

    2. LODs: Having multiple LODs = more draw calls?  If I have a mesh with 3 material elements, and 1 LOD, is that 8 draw calls?

    3. Does the command "stat scenerendering" shows only mesh draw calls, or is that also including draw calls for material elements?

    Thanks!
    1: This is entirely dependent on your target platform and how those materials are used. You're trading texture memory use for GPU state changes.  If you have a lower memory target, go for optimized textures. If you are GPU bound, but have VRAM to spare, go for the texture option.   Remember that one 4k texture = four 2k textures.  So you have additional memory overhead there.   

    Also this can't be truly answered without knowing how the materials are used. If you have props scattered throughout a level that all have the same 3 materials in some combination on their meshes, then that can be batched into just a few draw calls (possibly as few as 3) for the whole scene.  So no big deal. If you have individual characters with 3 materials each and those textures aren't re-used, and you have dozens of them in each scene, well, that can add up.

    It bears in mind thinking about how and why you're separating your materials to begin with. Is there transparency involved? That should be a separate material for quality reasons, and to ensure that it is less likely to experience z-buffer issues with other parts of the mesh behind it. 
    Does a well defined part of the mesh rely on fancy or expensive shader effects? That should be a separate material from the more simple parts. 

    Does part of the mesh use tiling textures that are used elsewhere in the scene that you'd have to basically copy in to a unique map otherwise?  Keep it as a separate material.

    Think about why you're using the texture res you're using. Are you keeping consistent pixel density? Are you using the texture effectively? How close is the camera likely to get? Can you get the same visual result with less?

    There's more to performance than draw calls. Cache coherence is a big one. Meaning if the GPU can keep the same set of textures in VRAM you spend less time per frame rendered, even if there are more things to individually render. This is because copying a texture from system ram, or from HDD storage to VRAM takes WAY longer than just calculating more pixels.  This is why some games implement megatexture atlasing under the hood. 

    2. No.   A mesh with 3 material elements should be about 3 draw calls.  The LOD models are not drawn unless you're at that LOD level, so no draw call occurs.  There isn't a separate draw call for the mesh without a material.  Draw calls are, literally, when the graphics API executes the function named "Draw()". (ie It Calls the Draw function hence Draw call) So you have to have a valid state to draw, which includes a triangle list and a shader program to utilize to fill the pixels those triangles occupy.  You'll need to have a separate call for when the GPU needs to change state, such as changing out textures, changing out shader programs, render targets, that sort of thing.  

    3: As noted before these aren't separate things. You cannot draw a mesh without a material, so the draw calls are the draw calls. 

    Check out https://docs.unrealengine.com/latest/INT/Engine/Performance/GPU/index.html and https://docs.unrealengine.com/latest/INT/Engine/Performance/

    For troubleshooting resources. 

    Also, while its good to have an interest in building performant assets, don't get too bogged down in the minutia of this. Make good looking art first. 
Sign In or Register to comment.