How can we get a fast graphic card without paying anything? A new feature called the Mesh Shader is a great advantage over the existing Primitive Shader and delivers great fps, smoother performance, and great visuals. Let’s check out how Mesh Shader is different from the Primitive Shader.
How a GPU renders
The visual data has to go through a set of steps to become a fully rendered image called a pipeline. But how does this pipeline bottleneck your gaming experience? Let’s find out how a pipeline actually works.
A GPU handles rendering through a pipeline consisting on 5 steps:
- Input Assembler
- Vertex Shader
- Rasterization (clip/cull/primitive assembly)
- Pixel Shader
- Output Merger
It starts with Indices and Vertices (Raw data, consisting of numbers) and ends with the final image. The first 3 steps of the pipeline, called the Geometry of Pipeline are really important. It actually ends up being where the bottleneck is.
Steps of rendering:
- The Input Assembler takes the vertices of the triangles that make up a finished image and organizes them so that they point to each other correctly.
- Now the organized set of vertices goes to the Vertex Shader, which raises or lowers the vertices to create a 3D mesh.
- Now that 3D mesh goes through Rasterizer, which puts pixels inside each triangle to fill out the image.
- The Pixel Shader then gives that appropriate color and lighting.
- The Output Merger puts different visual elements together. For example, if a character is standing in front of a wall, it ensures that you can not see the wall behind that character.
Why the first 3 steps of rendering causes bottleneck?
- The Input Assembler only understands data that is organized in a very specific way. It can’t accept compressed data that can be moved around quickly, or if a developer thinks of a more efficient way to organize their data the input assembler won’t simply be able to understand that.
- There are several optional stages in rendering after the Vertex Shader, like:
- Hull Shader
- Domain Shader
- Geometry Shader
- The geometry shader can take a point and expand it into a particular shape, like a strand of hair on a character. This is quicker than drawing a set of new triangles. But the Geometry Shader and other optional steps have been added over the years as games have become more complex.
- These optional stages have been stuck on the already existing pipeline in a rigid sequential way, which can’t be processed in parallel, meaning they make the process longer.
- Because of this rigid sequence, you have to wait until you get into the Rasterizer to start eliminating unused triangles, mainly which are off in a distance or behind the object on the screen. It is a problem because by the time the data gets to the Rasterizer phase of the pipeline, the GPU has already done a ton of work rendering unnecessary triangles. This in turn can make our graphic card not fast enough.
The solution of the bottleneck
Because the geometry pipeline is so inflexible, the solution isn’t in retooling it but replacing it entirely. This is where Mesh Shading comes into play, which is one of the biggest features of DirectX 12 ultimate API. It can make a graphic card work fast. Instead of having different steps before Rasterizer, the Mesh Shader is only one stage. It can do a few really cool things.
- The data that you feed into the Mesh Shader can be much more arbitrary, so it can understand compressed data and many other data sets which the Input Assembler couldn’t.
- The Mesh Shader works like a mini programmable computer. So if a developer wants to accomplish a rendering task more efficiently, they simply need to code into it.
- Each of the processes can intelligently communicate with each other in a Mesh Shader. So instead of calling a triangle late in the process, it can be done earlier. The geometry can also be arranged in a way to make culling easier, demanding lesser GPU power.
- The whole reason why it is called Mesh Shading is that it uses Meshlets. Instead of finding one triangle at once, your GPU can work on meshes of multiple triangles in parallel instead. So instead of making a decision about calling one triangle, the GPU can do that in batches, throwing out data it doesn’t need to process. This in turn saves precious GPU resources. Older vertex shaders only saw a group of points instead of an actual mesh, but mesh shaders are much smarter. Mesh Shaders can know exactly what they’re working with much earlier in the rendering process.
You can see Nvidia’s Mesh Shading Technique in the video below:
So what does that all mean?
Because your GPU doesn’t have to work that hard for each frame, you’ll get faster frame rates, and more detailed environments, the things we all expect from a fast graphic card. Due to Mesh Shader, you can expect an increase from 500-1800% of the increase in frame rates which is insane!
Currently, many game developers are looking for the best ways it can be implemented on their titles as well. Being such a customizable tool, and the Geometry Pipeline has been in existence for such a long time, it might take a few years before we can see widespread adoption of Mesh Shading in popular games, like Cyberpunk 2077 and Fortnite.
There is aready hardware support for it with newer consumer graphics cards like RTX 3090, RTX 3080, RTX 3070, RTX 3060 Ti, RTX 2080 Ti, RTX 2080 Super, RTX 2080, RTX 2070 Super, RTX 2070, RTX 2060 Super, RTX 2060, GTX 1660 Super, GTX 1660 Ti, GTX 1660, GTX 1650 Super, RX 6800 XT and many more.
By the time we see these games on the market, we all might have the next-gen graphics cards that support these new features by then.