1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. I will no longer be hosting XLNation as of March 1, 2017. Skullz613 will be taking the reigns of the site in early 2017 and XLNation will be moving to a new web hosting service. During that transition there will be an interruption in service of up to two weeks. Skullz613 is now a full administrator of XLNation. Be kind to him.

Let's discuss LOD optimizations to reduce the number of draw calls

Discussion in 'General Forum' started by bobqwerty, Feb 21, 2015.

?
  1. At least LOD3 should be a multiple of 128, 2^7

  2. Every LOD should be an even number

  3. I got 99 triangles and ain't bitching one!

  4. None of the options (explain below)

Multiple votes are allowed.
Results are only viewable after voting.
  1. bobqwerty

    bobqwerty Executive

    Joined:
    Aug 29, 2014
    Messages:
    79
    Likes Received:
    96
    Let’s keep this as an open conversation. There’s no ‘better way’. Pardon me beforehand if I said something detrimental in any way. (BEWARE WOT)




    Modders alike, let’s keep LODs' Triangle count down. The game might not be limited by our GPUs but optimizations in this department do improve CPU utilization. I don’t know about you, but most of the time I play I’m within L3 range. I imagine most people play in that range. It only makes sense we lower the triangle count of LOD3 models, right?



    Now that CXXL is out and comparisons have been draw, it seems to me the game starts to LAG because of DirectX mostly, driven by the high number of draw calls. Personally, I have a concern that will only change when city builder games make use of low level graphic APIs as DirectX 11 (or under) can’t handle thousands of buildings sucking draw calls (even more so if their poly count is high).

    Draw calls can be anything. They’re usually correlated with the objects being drawn on the screen. You want to keep it down to maintain good performance. The number of draw calls depends on a number of things, including number of maps (in the case of most games), shader passes and lighting. A draw call is command that tells the GPU to render a certain set of vertices as triangles, etc. Each GPU architecture processes a set of primitives, being it triangles or not, in their own way - with new GPU architectures being able to fetch more data per draw call (faster). The problem with High level APIs is they handle the communication between CPU and GPU in a much slower pace than the rate graphic cards process and render triangles, so you end up limited by your CPU.



    An approach to reduce the number of draw calls is to use bigger maps instead of UVW tilling. Tilling the whole UVW map in the modifier only makes sense if you tile half the textures and/or you don’t want to create a map with a square shape. If you have a 1024-bit map and use two UV tiles you end up with a 1024x2048-bit ‘virtual’ map IRL. Setting 4 UV tiles defeats the purpose of tilling.

    What most people do is to create Quads, slice geometry into pieces and unwrap them to the same UVW coordinates. That technique is great to increase the pixel density of what would have been a large face. On the other hand, the overhead related to the Triangle count increases accordingly, so are draw calls.

    The engine can handle maps of any given size (1x1 or 1x2). Sometimes a slightly bigger map can make for smoother gameplay… It’s simple math. You have N_maps x N_models x N_shadows, etc, driving draw calls up.



    The support for low level APIs is still underway. In the meantime, I think everyone should make his or her best to reduce the triangle count of LOD3.

    The modding guide doesn’t say much in this aspect. Though many only care about LOD4. I’m not saying everything should be ruled out. Greater flexibility helps the modding community. Hopefully, we can gather a poly count decrease in the future. I think LOD1 or LOD2 'don’t matter' as you have to be up close. Thus, you want LOD1 or LOD2 to have a greater level of detail. My point is all about LOD3. LOD3 max triangle count should be much lower if we want to have bigger cities, map sizes, more stuff in our cities. Like:

    T1 -> 512 tris
    T2 -> 768 tris (512 for smaller buildings)
    T3 -> 1024 tris
    T4 -> 2048 tris



    Note that the triangle count is based on the optimal value given GPU primitives processing rate. GPUs handle a set of 2^n primitives per draw call (1024, 512, 256, 128, etc). The higher the triangle count, the higher the draw calls. Sometimes it’s better to up the triangle count and waste less draw calls at the expense of GPU processing power. Always try to match your models triangle count to the closest binary numbers. (The same applies to maps. The pixel per draw call ratio has to be a multiple of 256, 2^8, at least). A large process takes less draw calls than multiple small operations, hence the output is completed more rapidly (and that equals to more Frames Per Second).


    api_calls_with_large_data_payload.png


    api_calls_with_small_data_payload.png




    In every game you are either draw call or memory bound, you'd pick one way of doing things or another. Doing either of them badly screws up everything, and I’m 99,99% sure Cities (X)XL suffer from the same evil as AC:U, too many draw calls. Look at the task manager… That’s why the first core spikes up when you have a huge city.









    Greenpeace-free-the-draw-calls.jpg :D
     
  2. Monty

    Monty Governor

    Joined:
    Aug 20, 2014
    Messages:
    697
    Likes Received:
    2,519
    That would work if you didn't have street level zoom, those triangle counts are very low for CXL type of gameplay. And larger texture maps would make sense if you could reuse them.

    I think the changes above won't fit CXL's gameplay.
     
  3. nicko2u

    nicko2u Governor

    Joined:
    Aug 22, 2014
    Messages:
    742
    Likes Received:
    1,053
    yep good ideas but unless the game engine/graphics is overalled it wont work? pretty much your asking for a new game.

    But on another note I often now duplicate l2 l3 models if they are low poly enough, that way you only create L1 (L2,L3) L4 = 3

    Though higher level mods I would dev all LODS ;)

    and DONT Presume everyone is using the latest game or PC ;)
     
  4. bobqwerty

    bobqwerty Executive

    Joined:
    Aug 29, 2014
    Messages:
    79
    Likes Received:
    96
    This is about GPUs and how the comunication between CPU and GPU works. We can't do much about the game models or the zoom level, but we can optimize our mods to use less draw calls. Regardless of the game engine or PC anyone has, we rely on DirectX. If anything, that would be more beneficial for those on a budget.


    The LOD3 estimatives are for mods of medium/normal size using LOD2. A 1500 tris LOD3 model, as stated in the modding guide, takes more time to render than a 1536 (512x3) tris.
     
  5. bobqwerty

    bobqwerty Executive

    Joined:
    Aug 29, 2014
    Messages:
    79
    Likes Received:
    96
    Here's a good article about DirectX 11 (and previous releases). Quite a long story. It details how mode switches consume large amounts of CPU cicles. GPUs are parallelized hardware blocks, as with any processor you want to feed the cores otherwise you would be underutilizing it and wasting precious time with command buffers sometimes. The link below, too, shows the impact of draw calls when rendering a heap of primitives. It's a concise article targetting different GPU architectures. The downside though, is the experiments were conducted in OpenGL, which is partially owned by Nvidia. Thought it to serves as the basis to show that a block of primitives can be processed faster than an odd number of primitives.

    https://msdn.microsoft.com/en-us/library/windows/desktop/bb172234(v=vs.85).aspx
    http://www.g-truc.net/post-0666.html
     
  6. nicko2u

    nicko2u Governor

    Joined:
    Aug 22, 2014
    Messages:
    742
    Likes Received:
    1,053
    If everyone followed the specs for building models that would be a start!

    T1
    L1: 2000 triangles
    L2: 1000 triangles
    L3: 500 triangles
    L4: 100 triangles

    T2
    L1: 4000 triangles
    L2: 2000 triangles
    L3: 1000 triangles
    L4: 100 triangles

    T3
    L1: 6000 triangles
    L2: 3000 triangles
    L3: 1500 triangles
    L4: 100 triangles
     

Share This Page