Rendering Manager

A game consists of several types of game objects. It consists of 3D game objects, buttons, joysticks, skyboxes, particle systems, etc. Each of these objects is rendered differently.

Different game objects require different shader programs and the GPU needs a different set of data for each of them. For example, a shader for a 3D game object needs Normal Vectors to simulate light. Whereas, the shader for a button object, does not. A button object does not require to simulate light.

To manage the different set of GPU data and Shader Programs, a Rendering Engine implements a Rendering Manager, U4DEngine::U4DRenderManager. The Rendering Manager is in charge of sending data to the GPU and enabling shaders during the rendering stage. Depending on the type of object it needs to render, it activates the appropriate shaders.

image

Graphically, the Rendering Manager is depicted as shown below.

image

Different game entities require different GPU Shaders. For example, a 3D object needs a GPU Shader vastly different than a 2D object.

During a game, the Entity Manager provides game entities to the Game Engine Loop. These entities are processed by the Rendering Manager, which detects their type and activates the corresponding GPU Shader.

Graphically, the process is as follows:

image

Moreover, different GPU Shaders require a different set of attributes. For example, a GPU Shader for 2D objects requires:

  • Vertices
  • UV Coordinates
  • Texture
image

In contrast, a GPU shader for 3D objects requires:

  • Vertices
  • Normal Vectors
  • UV coordinates
  • Textures
image

Once a shader is activated, and the required attributes are available, the Rendering Process begins.

The Rendering Engine provides the Rendering Pipeline with the attributes, uniforms and appropriate GPU Shader. In turn, the pipeline assembles and recreates the game entity on the screen.

image