Graphics Update, V1.2

Discussion in 'Planetary Annihilation General Discussion' started by varrak, March 15, 2014.

  1. varrak

    varrak Official PA

    Messages:
    169
    Likes Received:
    1,237
    Yes... :)
  2. varrak

    varrak Official PA

    Messages:
    169
    Likes Received:
    1,237
    The instancing uses the instance draw api, and a buffer containing per-instance data. The per-instance data varies depending on the light type. Point lights just need a position, radius and color. Capsules need position, radius, axis vector and color. Box lights take two matrices.

    This way is much more efficient than building a large buffer with copies of geometry, since the per instance data is just a few dozen bytes.
    Anijatsu, Methlodis and pcnx like this.
  3. pcnx

    pcnx New Member

    Messages:
    13
    Likes Received:
    12
    Is the assumption correct that the tradeof is much smaller when it comes to e.g. a box because storing 8 vertices with each 3 coordinates needs 24 floats (or whatever datatype used) and for two matrices usually 32 floats?
    Sure this is only valid for such simple geometry and thus still very much an improvement for more complex light geometry.

    Also i was wondering if you guys use one shadowmap for each planet, do you need some form of cascading or is the resolution of the shadowmap high enough not to show steps on the shadow borders?

    Thanks guys, you're giving me (and everyone else) a huge inside on the stuff under the hood!!
  4. aevs

    aevs Post Master General

    Messages:
    1,051
    Likes Received:
    1,150
    Just for the record, you can store the information for a box's dimensions, position and rotation in a single 4x4 matrix. Using vertices for that is impractical. Chances are they're using the second matrix for something else.
    EDIT: (Actually, you could probably just use a 3x3 matrix)
    Last edited: March 16, 2014
  5. pcnx

    pcnx New Member

    Messages:
    13
    Likes Received:
    12
    Yeah, they probably store light attributes like color in the second matrix. still the difference wouldnt be that great and i was just wondering if i think of it the correct way :)
  6. cdrkf

    cdrkf Post Master General

    Messages:
    5,721
    Likes Received:
    4,793
    I'd be really interested in hearing some of your thoughts on the challenges relating to this as I've heard that multi-threading a rendering engine is technically quite a difficult thing to do...? I'm actually surprised by how much you guys are achieving with a single thread at the moment so with an updated multi-threaded engine the game should fly (my rather dated laptop is currently holding up to PA pretty well, not bad for a 4 year old first gen i5 laptop chip. Edit, or rather not bad going you guys for getting the game running well on it.).
    Anijatsu likes this.
  7. LavaSnake

    LavaSnake Post Master General

    Messages:
    1,620
    Likes Received:
    691
    Thanks for posting that. It's always fun to read about the technical side of PA. I can't wait to see these changes in action!
  8. Corang

    Corang Well-Known Member

    Messages:
    772
    Likes Received:
    313
    cannot wait for this, performance improvement should be HUGE when this comes around
  9. pcnx

    pcnx New Member

    Messages:
    13
    Likes Received:
    12
    Well the multi-thread engine wont
    I wouldnt overrate this, i mean after all its still mostly the GPU which limits the rendering performance. Sure multicores are great for doing AI / physics etc computations but (and correct me if im wrong) having multiple threads for rendering is usually not such a vast improvement (since you still have to shove stuff on the gpu and the bandwith is also a limiting factor)
  10. Corang

    Corang Well-Known Member

    Messages:
    772
    Likes Received:
    313
    I have never had 100% gpu usage with this game, my cpu has always been the limiting factor, when this goes multicore I expect a big perf improvement
    cptconundrum likes this.
  11. Corang

    Corang Well-Known Member

    Messages:
    772
    Likes Received:
    313
    also how much work does making PA multicore compatible entail?
  12. keterei

    keterei Active Member

    Messages:
    258
    Likes Received:
    93
    Glorious! Very cool.
  13. mabdeno

    mabdeno Active Member

    Messages:
    138
    Likes Received:
    67
    Does Picture in Picture still double the amount of things being rendered on the screen or have you managed to find some work arounds for this as well?
  14. nours77

    nours77 New Member

    Messages:
    7
    Likes Received:
    1
    it is good to heard, i can t wait to play with more fps.
    I do not often thanks the devs, they are working and be paid for their game after all. (no thanks to me when I finished building a nice wall, it is my job...)
    but "Merci et bon courage pour la gamma !"
  15. varrak

    varrak Official PA

    Messages:
    169
    Likes Received:
    1,237
    Actually, it really depends. The CPU is responsible for packaging up all the commands the GPU consumes to do it's rendering. There's state, shader programs, shader parameters ("Uniforms" in OpenGL), and so on. It is actually pretty expensive. Every time you call "draw" the runtime and driver actually do a ton of work. We have tens of thousands of draws that we do in PA. The CPU would never be able to keep up, were it not for instancing (otherwise known as batching) where you upload a minimum set of data and then dispatch many similar draws in one call. 7500 draw calls for lights was taking in the 10s of milliseconds per frame on the CPU. That's more than half your frame budget if you're aiming for 60fps. Now, with instancing that same operation takes less than 1 ms. That moves more of the burden over to the GPU.

    Ultimately the goal is to have both CPU and GPU fully utilized. We'll see how close we get... ;)
  16. pcnx

    pcnx New Member

    Messages:
    13
    Likes Received:
    12
    Is there a particular reason you chose OpenGL over DirectX?
  17. Quitch

    Quitch Post Master General

    Messages:
    5,850
    Likes Received:
    6,045
    Cross platform support.
    SXX and tatsujb like this.
  18. pcnx

    pcnx New Member

    Messages:
    13
    Likes Received:
    12
    i didnt really follow the start of the project all that much...
    was that one of the parts they advertised in the kickstarter campaign?
  19. Quitch

    Quitch Post Master General

    Messages:
    5,850
    Likes Received:
    6,045
    The game has to run on Windows, Linux and OS X.
    SXX likes this.
  20. bgolus

    bgolus Uber Alumni

    Messages:
    1,481
    Likes Received:
    2,299
    The naive downsampling is done on the GPU with a single pass shader that does the downsampling and the luminance conversion in one pass and not needing any more memory beyond the existing input buffer and scaled down output buffer.
    Generating a full mipmap chain on a large, non power of two texture might be faster on its own than the shader we're using, but then we'd still have to run the shader to convert it from color to luminance and we waste a good bit of memory on mipmap levels we never need. Internally the mipmap generation process is going to be nearly identical to what we're already doing, so it is unlikely we'd get any performance back.

Share This Page