top | item 33298574

(no title)

andrewallbright | 3 years ago

As a hobbyist game dev one thing I've (recently) learned is that optimizing performance is paramount in video games. Running at 60 FPS you have a budget of 16 ms per frame (VR requires 90 FPS minimum else risk VR sickness; ~11ms per frame). Any scripts and anything you want on screen needs to fit in that amount of time. It's a big exercise in smoke and mirrors.

I'd love to know what optimization techniques are used so that those precious CPU/GPU cycles can go to those good looking things.

Side note: being absolutely forced to optimize the heck out of games as an essential practice gives me a much greater sense of performance characteristics in my "real" job and also in leetcode.

discuss

order

jessermeyer|3 years ago

Modern renderers:

Use the GPU to decide what to render, and in a growing number of cases, will cull triangles in compute (software) instead of letting the fixed pipeline do it. The vertex shader feeds parameters to the fragment shader even if the triangle is culled (depth or backfacing), so with vertex counts climbing, there is a lot of dead time spent feeding fragment shaders that are never ran.

Render at a lower resolution and temporally upsample to a higher resolution.

Using low overhead apis that optimize command recording performance (DX12, Vulkan) and transfer / memory access.

Multithread all the things.

Obsess over data locality and compression.

dclowd9901|3 years ago

Culling triangles seems to be going away though, especially with the rise of ray tracing. The expectation is that even aspects of the scene we can’t see influence lighting. How are they managing that?

Tiktaalik|3 years ago

At a high level it's about doing as little as possible.

Don't allocate memory. Don't re-layout ui. etc

eclipxe|3 years ago

You can get by with 72 fps in VR and avoid sickness.

andrewallbright|3 years ago

That's good; you get more of a frame budget that way. I saw 90 and even 144 as target frames to avoid VR sickness. It's good to know 72 frames can work too.