Advertisement

Relationship between resolution and polygon count

Started by September 20, 2024 08:27 PM
7 comments, last by Newgamemodder 2 hours, 36 minutes ago

Hi Gamedev forums!

Hope all is well with you guys :D

I'm trying to research things regarded to graphics programming. So i get 8,294,400 is the pixel amount for 4K. I also understand that a rule of graphics is 1 triangle per pixel. Lets say i have X amount of triangles in my frustum. Will only 8,294,400 worth of triangles be in view?

Now if that is the truth how the expletive is this company manageing to render 1.8 billion triangles?

https://developer.nvidia.com/blog/realistic-lighting-in-justice-with-mesh-shading/

And how is it that this youtuber manages 800 million triangles at 12K? Shouldn't it be a maximum of 79,626,240?

Just wanna point out this is mesh shaders and not nanite im looking for info about.

Thanks and hope you guys can help me understand this thing that is making me pull my hair out!

Newgamemodder said:
I also understand that a rule of graphics is 1 triangle per pixel.

Not sure what you mean, but if we use teh GPU hardware to render one triangle per pixel, that's inefficient.
GPUs assume that the triangles are larger, and there are always 4 pixel shader threads combined to work on a quad of 2x2 pixels. Often some of those pixels are not inside the triangle, but the threads do the calculations anyway, which is a waste. So if we render one pixel sized triangles, only 25% of GPU threads contribute to the visible image.
That's the primary reason why Nanite uses a software rasterizer implemented in compute for small triangles, which is faster than hardware acceleration in this case.

Newgamemodder said:
Lets say i have X amount of triangles in my frustum. Will only 8,294,400 worth of triangles be in view?

We can exceed this limit in multiple ways:
Using MSAA multiple triangles can contribute to a single pixel, e.g. at most 4 with 2x2MSAA, or 16 with 4x4MSAA.

Using TAA it can be even more, which uses typically 64 samples. Even if in one render only one triangle can win the pixel, by combining multiple frames multiple triangles contribute to one visible pixel.

Same for other anti aliasing techniques. Any form of AA requires that multiple triangles can contribute to one pixel.

But ofc. this does not mean you could see subpixel details on your screen. The only reasonable goal here is smooth images. Ideally our tirangles are not smaller than a pixel. If we do this, we create a new potential source of aliasing. If the screen resolution is not high enough for our details, the pixel starts to flicker because just one triangle wins it, out of a selection of many tiny subpixel triangles with all different colors.
So it's not just a waste of resources, it also looks bad.

Newgamemodder said:
Now if that is the truth how the expletive is this company manageing to render 1.8 billion triangles?

Newgamemodder said:
And how is it that this youtuber manages 800 million triangles at 12K? Shouldn't it be a maximum of 79,626,240?

Having a scene of X triangles at the highest level of detal does not mean all of them are actually visible. Some may be off screen, some will be face backwards, others will be too small to intersect a pixel center, and most important: Many of them will be occluded by other triangles in front of them, and many are replaced by a lower level of detail for a current perspective.

So they talk about 3D datasets and how much of it they can manage and process.
Notice this is independent from the final presentation on a flat 2D screen.

If i want to impress, i'll make two related statements:

  1. My scene has 24 trillion triangles.
  2. But i only need to render 3 millions of them per frame, showing all the glorious details.

The first they tell to consumers, the second they tell to devs at GDC.

Advertisement

Thanks JoeJ!

Always appreciate your wise guidane and responses! :D

About the 800 mil thing iirc it actually was post culling and other stuff :D (you are completely correct by the “my scene has x amount of triangles”

At 0:45

I think the 1.8 billion was post culling aswell :D

So you can have any polygon count at any resolution but it'll need Anti aliasing?, but also the polygon count is influenced by lods, triangle intersections and backface culling and culling in general

For example my total polygon count in the frustum is about 5 billion but i know nowhere near that amount will be rendered, but with various culling, LODS and other optimization do you think it can be done with mesh shaders?

I always feel alot wiser after posting here :D

Newgamemodder said:
About the 800 mil thing iirc it actually was post culling and other stuff :D (you are completely correct by the “my scene has x amount of triangles” At 0:45

I see they claim 50M:

Haha, i see they covered both my marketing statements. And i did not even watch the video before. :D

Newgamemodder said:
So you can have any polygon count at any resolution but it'll need Anti aliasing?

Yes. Think of older games like Quake. Ther was no AA back then, but because the triangle resolution was so low, nobody had a problem with crawling edges. It was even nice and satisfying to watch how the edges crawl from pixel to pixel.

But as geometry became more detailed, there were more and more edges on the screen. The crawling eventually dominates the whole image and is very distracting. Anti aliasing is the solution.

So yes, if the frequency of geomtric detail is high compared to the resolution of the image, we need antialiasing for spatially and temporally smooth images.

But there are two ways to achieve antialiasing:

Multisampling: Examples are ray tracing or TAA. It works by taking many samples within the area of a pixel and calcualting their average. But it's expensive, and so we may reduce the cost by accepting samples from older frames.

Prefiltering: Examples are texture MipMaps or levels of detail for geometry. Here we precompute the average over a larger areas at multiple scales, and then taking just one sample from the scale matching our sampling resolution gives the desired result. So far we have solved this problem really well for textures, where it's trivial. But for geometry it's much harder.

Newgamemodder said:
For example my total polygon count in the frustum is about 5 billion but i know nowhere near that amount will be rendered, but with various culling, LODS and other optimization do you think it can be done with mesh shaders?

It can be done. Nanite is the example, which also uses mesh shaders for larger triangles.
But what's actually practical in a specific case depends on engine, target platform(s), storage limits.

Ha, i have to post this. The unforgotten mystery of ‘Unlimited Detail’. :D

Still unbelievable he did this on a laptop CPU. What a gfx programmer. :O

Heh i noticed i wrote 800 million then linked the wrong video lol tsktsktsk xD

If what i want becomes possible what type of Anti aliaiasing should i use and what resolution?

It probably won't use nantie but will use mesh shaders in their own engine, i assume this changes nothing? 🙂

Highly doubt it will ever be higher than 5 billion tris. I haven't counted shadow meshes and collision meshes (do i need to count shadow and collisions? neither projectiles and particle effects. Also my 5 billion is pre culling and lods.

You've been super helpful Joej! :D

Advertisement

Newgamemodder said:
If what i want becomes possible what type of Anti aliaiasing should i use and what resolution?

Haha, that's a very bad question. People pull out their pitchforks and pop each other an eye out when it comes to declaring the best AA method.

Imo the truth is: TAA is all we can afford. But some people really hate it, and thus AA remains an open problem.

For resolution, this really depends on content. (i guess you mean triangle counts not screen res.)
If i look at those asteroids from the video, that's pretty smooth geometry, and the blurry SSAO lighting makes it even more smooth. I can see no details at all. Only when they turn on wireframe mode i'm eventually impressed technically, but for that content it's just pointless.

A better case would be detailed spaceships, with lots of sharp features and small stuff on them.
To make the details visible, we would need accurate and sharp shadows for a gritty image.
In this case you need as much triangles as the content requires, but ofc. you can model only as much small features as the hard/software can handle.

Newgamemodder said:
It probably won't use nantie but will use mesh shaders in their own engine, i assume this changes nothing?

So your nickname isn't accurate anymore? It's not about mods, but about real development?

Does not change anything, since mesh shaders still raster triangles, causing the same aliasing problems.

Actually i meant resolution like 4K or does it not matter if i use 4K with TAA? was thinking higher screen res = less AA

Was thinking High poly LOD0 and LOD1 but low poly shadow mesh and collision. I did a recaluculation of my polycount and excluding particles and laser polygon count i'm at about 2.49 billion. Hance why i'm throwing around 5 bil because i don't know about the particles and projectiles….

Haha my nickname is still accurate, just checking what is possible to ask a company to do xD

Advertisement