The NVIDIA Asteroids demo showcases how the mesh shading technology built into NVIDIA’s Turing GPU architecture can dramatically improve performance and image quality when rendering a substantial number of very complex objects in a scene. The following video highlights the capabilities of the mesh shader in the Asteroids demo.

This video shows off the Asteroids demo in action.

Turing introduces a new programmable geometric shading pipeline built on task and mesh shaders. These new shader types bring the advantages of the compute programming model to the graphics pipeline. Instead of processing a vertex or patch in each thread in the middle of fixed function pipeline, the new pipeline uses cooperative thread groups to generate compact meshes (meshlets) on the chip using application-defined rules. This approach greatly improves the programmability of the geometry processing pipeline, enabling the implementation of advanced culling techniques, level-of-detail, or even completely procedural topology generation. You can find more information on mesh shading in the detailed technical introduction to Turing mesh shaders.

The Asteroids application can achieve very high frame rates by moving key performance bottlenecks of object list processing off of the CPU and into highly parallel GPU mesh shading programs. Starting from an extremely large dataset comprising trillions of potentially visible triangles at any given time, the shaders efficiently eliminate primitives that will never be seen and shade only those contributing to the pixels displayed.

In the demo, each individual asteroid model consists of a sequence of 10 levels of detail, with the highest level containing up to 6 million triangles, as shown in figure 1. This extreme amount of geometric detail allows the largest asteroids (several kilometers in size) to retain a very detailed look, even when the player is flying extremely close. You can inspect the triangle meshes by switching to wireframe mode. Activating “Visualize LOD levels” paints each asteroid with a color based on its current LOD, showing how the mesh shaders transition smoothly between LODs. Finally, you can also turn off the dynamic LOD system, and then be able to select the display of any of the first 7 levels of detail.

In addition to dynamic LOD, mesh shading also allows the implementation of smart culling systems, greatly improving rendering efficiency. Culling takes place hierarchically in the demo.

First the task shader checks the entire asteroid for visibility and determines which LOD(s) to use.

Sub-parts, or meshlets are then tested by the mesh shader.

Finally, the remaining triangles are culled by the GPU hardware.

Prior to the arrival of the Turing architecture, GPUs would be forced to cull every triangle individually, creating massive workloads on both the GPU and CPU.

By combining together efficient GPU culling and LOD techniques, we decrease the number of triangles drawn by several orders of magnitude, retaining only those necessary to maintain a very high level of image fidelity. The real-time drawn triangle counters can be seen in the lower corner of the screen. Mesh shaders make it possible to implement extremely efficient solutions that can be targeted specifically to the content being rendered.

Tessellation is not used at all in the demo, and all objects, including the millions of particles, are taking advantage of Mesh Shading.

We recommend using a gamepad to control the movement of the camera and spaceship; mouse and keyboard support is also available to control movement. See the readme file for a complete list of controls.

You can download the Asteroids demo here and give it a try if you have a Turing-based GPU. You can find an in-depth tutorial on using mesh shaders in the Introduction to Turing mesh shaders post. Christoph Kubisch delivered a talk on mesh shaders at the 2018 SIGGRPH conference, which is available for viewing. Finally, if you’d like to learn more about graphics advances built into the Turing architecture, please head over to the Turing Architecture in Depth article.