# Rendering module

The rendering module is the most important part of the entire framework. It is this part that reflects the performance advantages of the small game framework over the traditional small game solutions. This is also the foundation for the small game framework to support the operation of medium and large MMOs in the small game environment.

Due to the complexity of the rendering system, the entire rendering system is divided into several parts:

# resource

Resources can be considered as data sources for rendering. They record the vertex information, rendering status, buffers, etc. required for rendering. We abstract these resources into the following system for organization:

  1. Mesh: Used to manage vertices, index data and descriptors.
  2. Buffer block: Used to manage buffered data, such as various matrices.
  3. Texture: used to store image data.
  4. Render Canvas: Used to provide a canvas on which the camera can draw and use it as a texture.
  5. Shader: The shader directly determines how the vertex data and pixels are actually rendered and managed by effects.
  6. Effects and materials: The effect describes a series of shaders and a collection of rendering states. The material uses the effect as a template to determine how the object should be drawn in the end.

# Renderer

The renderer Renderer is used to assemble the above resources and prepare for rendering. The solution has built-in some common renderers:

  1. MeshRenderer: Basic mesh renderer, used to render static models.
  2. SkinnedMeshRenderer: Skinned mesh renderer, used to render skinned models with bones.
  3. LineRenderer: Line segment renderer, used to render line segments.
  4. TrailRenderer: Trailing renderer, used to render the trailing effect.

In addition, the particle system can also be considered as a renderer as the core.

# Scenes and cameras

A lot of renderers are hung on the node and assembled together to form a basic scene, and the camera provides different projection methods as the entrance for the player to observe the scene:

  1. Scene
  2. Camera

# Lighting, shadow and fog effects

In order to make the rendering more realistic, lighting needs to be added to the scene. Lighting can produce shadows. In addition to real-time shadows, there are also light maps that can be pre-calculated. In addition, the fog effect can also increase the realism.

  1. Light source
  2. Lighting Model
  3. Shadow
  4. Lightmap
  5. Skybox and Ambient Light
  6. Fog effect

# Rendering system

With the support of each of the above sub-modules, a global management system is needed to link all of these together to achieve the final rendering effect, which is the "rendering system". The rendering system has some global configurations, and uses the render graph Render Graph to manage the entire rendering process. It also directly provides open customization capabilities for developers to customize their own rendering pipeline. Currently, the system integrates a * Forward Add* rendering pipeline.

  1. Rendering System
  2. Render Graph
  3. Built-in nodes
  4. Built-in pipeline
  5. Deep pipeline

# Post-processing

The small game framework based on the rendered image also provides a post-processing system and provides a resource for easy use.

  1. Postprocessing System
  2. Postprocessing Node
  3. Postprocessing resources

# Optimization

On top of the basic functions, the small game framework also provides some solutions to allow developers to customize rendering to achieve a balance between CPU and GPU performance.

  1. GPU instancing
  2. Batch