Is geometry represented outside OpenGL ES Frustum?

I am developing a game for iPhone using OpenGL ES, like drawing api. I draw a whole big world in one drawing element. The object is visible depending on the truncation.

I want to know what happens to another part of the object, is it drawn? Does it affect FPS?

+4
source share
3 answers

For any vertex of the scene, you must run the vertex shader so that their coordinates are transformed from the model space to the clip space.

After that, primitives that are not contained in the clipping volume (which means that they are either off-screen in the clip space or too far or too close) are trimmed so that they are not processed further and the pixel shader will not be launched for them.

This is the same for OpenGL and OpenGL ES. You can find the details in the OpenGL ES spec (2.13 Primitive Clipping) or in the OpenGL specification (same heading).


This means that with a lot of geometry, most of which are outside the truncated cone, it will slightly affect the rendering time, but much less than if the whole geometry was actually displayed . Only per-vertex transformations need to be performed; rasterization and operations with pixels (fragment shader, actual recording in the framebuffer) will not be performed for them.

It also means that if you perform many operations on vertices and fewer operations on pixels, then it may be more important to write additional visibility checks for your scene.

+3
source

OpenGL handles all the primitives that you specify for drawing. That is why you must determine what to draw. This is a really difficult problem as the starting point reads this .

+1
source

A geometry contour converts the coordinates of the vertices to the coordinates of the window; in this case, polygons outside the window may be discarded. But too much simple geometry is being processed, and performance is dropping.

Think about how to use some kind of truncated truncation: divide your scene into smaller parts or tiles and evaluate before the picture if the tile is completely out of view, thus only drawing tiles that could be inside the truncated cone.

Even with a simple section, the difference should be noticeable.

0
source

Source: https://habr.com/ru/post/1383179/


All Articles