D
D
Daniel2020-07-25 19:11:50
3D
Daniel, 2020-07-25 19:11:50

How does overlapping objects affect rendering speed?

If you first draw objects in the vicinity of the camera, and then draw other objects behind them, will it be faster than drawing objects in random order? fragments that are not visible on larger objects, right?)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Evgeny Shatunov, 2020-07-26
@Porohovnik

The absolutely exact answer to your question is: depending on how you set up the context.
Here it is worth remembering some basic stages of the graphics pipeline.
The first step is processing the vertex data. It is executed for every vertex in the primitive. The user does not have the right to refuse to process any vertex. On the other hand, the processing of vertex data is usually fast and there are usually far fewer vertices than fragments.
Therefore, in order to load the GPU with only the correct vertices, these vertices should be correctly selected for transfer to it. This should be the responsibility of the stage of clipping primitives when preparing a frame for presentation.
The second important stage now is the processing of fragment data. Rasterization , to put it simply.
For rasterization, each primitive is divided into fragments, which are processed individually. At the rasterization stage, you can already refuse to process the fragment directly in the shader. This can slightly speed up the presentation of the frame.
The processing of fragments of different geometry is not regulated in any way and can occur in any order.
In this case, if one fragment is related to several sections of the geometry, it will be calculated from each such section. This is called Overdraw .
Overlapping not only leads to processing of unnecessary, often invisible, fragments, but also leads to graphical artifacts, such as z-fighting. Developers try to avoid overlapping geometry through more aggressive clipping of polygons in the model and sorting geometry, not models, in space. There are also a number of effective depth buffering techniques ( for example ) that allow you to almost completely deal with overlap.
Therefore, with the correct setting of the context, when choosing only the geometry that is important for the frame, when working with a depth buffer, when using Adaptive Shading and discarding fragments from the rasterization stage in time, the presentation speed will be higher than without all these settings.
If you make your own z-prepass , then sorting the geometry by the distance to the camera will become redundant for you.

P
Programiker, 2020-07-25
@Programiker

random drawing of objects is slow

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question