by andrewallbright · 4y ago · 0 comments
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.
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.
That said, it seems like the culling advice for RT is "expanded camera frustrum" culling, distance culling dependent on size, and choosing the right geometry LOD. Beyond that they want you to aggressively mark geometry as opaque and carefully arrange objects into groups (BLASes) according to a couple rules so the GPU can skip as much work as possible.
https://developer.nvidia.com/blog/best-practices-using-nvidi...
Rendering objects that 'we can't see' has been done for as long as shadow caster light sources have been around. Even though we cannot see the mesh directly, the light can, and the viewer can see the shadow. These indirections all play their role in the greater "rendering equation", and the specific solution depends on the constraints of the application and resources of the development team.
Some renderers have abandoned triangles altogether for signed distance fields, but this involves re-creating from scratch the entire art pipeline.
Don't allocate memory. Don't re-layout ui. etc
[1] https://medium.com/@ThisIsMeIn360VR/motion-sickness-and-the-...