Avoiding unnecessary render calls with frustum culling
Rendering is the most essential operation within a video game. However, it is not a cheap process, as it requires sending data from memory to the GPU as well as a sequence of steps within your GPU to transform the input data into the final 2D image.
This input data consists of vertices that are no more than points with extra attached information, such as texture coordinates. They will serve as a base for constructing basic shapes.
The following is a summarized and simplified screenshot about this process:
Here is a brief but concise explanation:
- Vertex shader: The main goal of this option is processing the aforementioned vertices. Additionally, it works as a walkway for later steps to receive important attributes such as color and texture coordinates.
- Shape assembly: This option joins those vertices in order to form primitive shapes.
- Geometry shader: This option evaluates the primitives passed from the previous step, and modifies them if...