Slashdot Mirror


Reverse-Engineering GTA V (adriancourreges.com)

An anonymous reader writes: Software engineer Adrian Courrèges posted on his blog a breakdown of the rendering of a frame in Grand Theft Auto: V. Each rendering pass is explained in detail, with all the techniques and the tricks Rockstar used to make the game run on 8-year-old consoles. It's a fascinating trip through the making of a frame and reminds us of how far GPU computing power has come. Here's a brief snippet from the beginning: "As a first step, the game renders a cubemap of the environment. This cubemap is generated in realtime at each frame, its purpose is to help render realistic reflections later. This part is forward-rendered. How is such cubemap rendered? For those not familiar with the technique, this is just like you would do in the real world when taking a panoramic picture: put the camera on a tripod, imagine you’re standing right in the middle of a big cube and shoot at the 6 faces of the cube, one by one, rotating by 90 degrees each time. This is exactly how the game does: each face is rendered into a 128x128 HDR texture."

37 comments

  1. This is how cubemap reflections are made in every by Anonymous Coward · · Score: 1, Insightful

    Every game and piece of software, and have been made this way for decades.

  2. How is such cubemap rendered? by wonkey_monkey · · Score: 1, Funny

    How is such cubemap rendered?

    And how is babby formed?

    --
    systemd is Roko's Basilisk.
    1. Re: How is such cubemap rendered? by Anonymous Coward · · Score: 0

      How IS babby formed?

  3. Re:Is this all just speculation? by UnknownSoldier · · Score: 4, Informative

    Easy. By

    a) examining the assembly from the pixel shader.
    b) discarding all rendering until the end of frame.

    The only "interpretation" is how the HDR tone mapping is applied but it is close enough to the real game that it is a minor point.

  4. Re:Is this all just speculation? by Anonymous Coward · · Score: 0

    Why didn't you just fuck her in a bed like a normal person would?

  5. Re:This is how cubemap reflections are made in eve by Anonymous Coward · · Score: 0

    GTA V doesn't even look as nice as Just Cause 2 nor does it have as large of a game world and JC2 came out years before.

  6. Re:Is this all just speculation? by Anonymous Coward · · Score: 1

    How do you disassemble the pipeline logic on the GPU? You know, the thing that does most of the work. This isn't just occlusion techniques and tracing.

  7. Who cares? by Anonymous Coward · · Score: 0

    Nerds

  8. Re:Is this all just speculation? by war4peace · · Score: 0

    That's where he lives.

    --
    ...gis sdrawkcab (usually not responding to ACs; don't bother posting as AC)
  9. Re:Is this all just speculation? by Anonymous Coward · · Score: 0

    By using RenderDoc, as stated in the article.

  10. Re:Is this all just speculation? by Anonymous Coward · · Score: 0

    I'm confused. Are you implying that he lives in a bed, or in a so-called "poop-chute"?

  11. Re:Is this all just speculation? by Anonymous Coward · · Score: 0

    "I can tell by some of the pixels"

    fixed.

  12. Re:Is this all just speculation? by Anonymous Coward · · Score: 0

    Go home dad, you're drunk.

  13. Re:Is this all just speculation? by Shinobi · · Score: 1

    You use some of the dev tools available for that

  14. Re: Is this all just speculation? by Anonymous Coward · · Score: 0

    indeed. She prefers the anal cavity due to the inhuman length of my penis (which is 34" long).

  15. Now how about fixing the severe cheating? by Anonymous Coward · · Score: 0

    The game is beautiful, but completely broken on multiplayer due to the extreme and blatant cheating.

    1. Re:Now how about fixing the severe cheating? by Anonymous Coward · · Score: 0

      The game is beautiful, but completely broken on multiplayer due to the extreme and blatant cheating.

      Which is due to how they, along with many other games, continue to blatantly disregard the 1st rule of multiplayer design, which is "Never, ever trust the Client". And the 2nd rule, which is "Never, ever send any game data to the Client which the Player should not have access to." And the 3rd rule, which is "Never, ever use direct peer to peer communication between players", and the 4th rule, which is a sub-set of rule #1, "Never, ever allow a Client to also act as a Server."

      Those rules should only be ignored if you are making a game where the players are fully in charge of match setup... i.e. they are only going to be playing with/against people who they personally trust to not cheat or DDoS each other.

      But those rules are often broken because it makes it a lot easier, and cheaper, to get a "twitch-based" type of game to play effectively over the internet.

  16. Where can I find more? by Ormy · · Score: 2

    I am not a programmer, I do not work in the IT business, but I find this kind of stuff incredibly fascinating, its a major reason I still come here. So much so that I remember very clearly a particular article from a few months ago about auto-generating dungeons. Where can I find more?

    1. Re:Where can I find more? by Purity+Of+Essence · · Score: 2

      A good place to start might be the talks archived at the GDC Vault.
      http://gdcvault.com/

      You can read all back-issues of Game Developer Magazine there as well.
      http://www.gdcvault.com/gdmag

      And sister website Gamasutra has loads of stuff like this.
      http://gamasutra.com/

      More low-level and rudimentary topics are covered by a couple of good YouTube channels.
      https://www.youtube.com/user/B...
      https://www.youtube.com/user/c...

      If you want to dip your toes into game development without needing to know anything, check out Tom Francis' GameMaker tutorials.
      https://www.youtube.com/watch?...

      --
      +0 Meh
    2. Re:Where can I find more? by Purity+Of+Essence · · Score: 1

      Also, forgot to mention this, if you want to get in deep, check out Casey Muratori's Handmade Hero series of live-coding streams. See how a game can be built entirely from scratch without starting with prebuilt engines, special tools or middle ware. Follow along and make the game yourself. Every aspect is covered in incredible detail.

      https://handmadehero.org/

      --
      +0 Meh
  17. Re:Is this all just speculation? by MobileTatsu-NJG · · Score: 1

    By the way, I fucked your mom in the poop-chute.

    To bring this back on topic you'll need either ZBrush or ... heh ... Mudbox.

    --

    "I like to lick butts!" by MobileTatsu-NJG (#32700246) (Score:5, Informative)

  18. Re:This is how cubemap reflections are made in eve by Ormy · · Score: 2

    As someone who 100%'ed JC2 (well, 99.95%, which was the best you could do because of a bug) I beg to differ. The sky and terrain on JC2 looked amazing and indeed rival modern games including GTA5, but the extra detail and variety and sheer amount of stuff going on in each and every scene in GTA 5 make it a massively prettier game, even if each individual element is not much more detailed then any other recent large open world game. The reflections and water in GTA5 are way ahead of JC2. Never mind that GTA5 is far more GPU usage efficient, yes the PC version of JC2 on max setting might look better than the PS3 version of GTA5 but that's hardly a fair comparison. Infact the GTA5 PC version has extensive GFX tweakability even for a PC game, and to run it om even above-average settings requires a top tier card and more VRAM than I care to speculate. In terms of world size, have you heard of Oblivion? JC2 is nothing, yes the world map may be physically huge but its so empty and unvaried compared to (admittedly newer) other games. In terms of explorability and variety I'd say Far Cry 4 packed in way more stuff to explore and discover and more variety than JC2 in a much smaller map.

  19. 30 year technique. by Anonymous Coward · · Score: 0

    So cube mapping is innovative how?

    1. Re:30 year technique. by Anonymous Coward · · Score: 0

      The innovation is getting someone to RTFA.

  20. Re:Is this all just speculation? by Anonymous Coward · · Score: 0

    No it's actually much cooler than that. You see we have these tools for debugging graphics. PIX for Windows, Intel GPA, Nvidia Parallel (or whatever they calling it now) as well as a lot of others. With these tools you can see every last call made to DirectX or OpenGL (depending on what the game uses and what the tool is made for). You can see what parameters are passed into those calls. The really good ones like PIX let you click on a call in the stack and see what the screen looked like up until that call.

    On top of those you can do as you were thinking, peel back shader assembly but sometimes they are compiled with tools that produce proprietary assembly which may as well be complete nonsense. The DirectX and OpenGL shader assembly languages aren't the lowest level, just another intermediate level before the specific assembly language of the card itself. The tools to compile into those proprietary languages are freely available, most graphics programmers either don't know about them or choose not to use them (for debugging reasons) but sometimes it's the only way to get that extra ounce of performance you need to make a hard technique "real-time".

    Now most programs you buy, especially from AAA studios like Rockstar are built with a flag that disables such tools. That flag has a huge weakness though. It's flipped at run-time, typically during the initialization phase. This means it's very weak to injection attacks that even a child can learn. The specific attack looks like the call is made to the program, but instead of the flag being flipped the attacking code just ignores it leaving the default state of being debuggable in place.

  21. Re:This is how cubemap reflections are made in eve by Purity+Of+Essence · · Score: 1

    If you manage get past the summary and read the detailed three-part article you might actually learn something. Insightful, my ass.

    --
    +0 Meh
  22. Re:Coo by Falos · · Score: 1

    [pigeon-mode intensifies]

  23. Re:This is how cubemap reflections are made in eve by Anonymous Coward · · Score: 0

    You must have played JC2 on shit hardware. Everything about it looks better than GTA V.

    GTA V also has a tiny game world, about 1/8th the size of JC2.

  24. Re:Is this all just speculation? by war4peace · · Score: 1

    You get to pick. I vote for the latter :)

    --
    ...gis sdrawkcab (usually not responding to ACs; don't bother posting as AC)