Forward Rendering is a technical term that is extremely important in rendering and optimizing game graphics (technical art). The most standard and compatible rendering method that projects objects one at a time to the camera and processes light calculations on the fly simultaneously.

Rendering pipeline basics and forward method overview

The rendering pipeline in 3D game graphics is a processing process that converts object information existing in 3D space into pixel information on the screen. The most classic of these, and still widely used today, is **Forward Rendering**. This method sequentially processes each game object to be drawn. The polygons of each object are projected onto the screen, and at the same time as the shape is drawn, all color and shading calculations are performed on the fly using real-time lights present in the scene, and the colors are written directly to the final screen (frame buffer).

Real-world analogy: A restaurant where the chef makes a round trip to the customer's table each time to respond to individual special orders

To understand how this works, let's compare the graphics board (GPU) to a "restaurant kitchen and chef," the objects to be drawn to "customers at a table," and the number of lights in the scene to "the various toppings and sauces ordered by the customers."

Forward rendering is a style in which each customer completes their order one by one, and each time the chef completes the dish according to their individual requests (influenced by the light) and brings the dish back and forth to the customer's seat many times. For example, let's say the customer at table 1 orders a hamburger steak with sauce (light 1) and cheese (light 2). The chef grills the hamburgers in the kitchen, tops them with all the toppings, and delivers the finished product to the table. Next, move on to the customer at the second table, listen to their orders in the same way, add toppings, and bring the food to them.

The advantage of this method is that it is possible to respond flexibly and completely to each customer's detailed requests (e.g., requesting a special sauce just for this person to accommodate allergies, or serving the food on a "semi-transparent" glass-like plate) on the spot. However, there are also disadvantages. If there are 100 customers, each ordering 3 light toppings, the chef will have to go back and forth from the kitchen to the customer table a total of 300 times, which will quickly lead to service delays (FPS).

Detailed mechanism and operating principle

With Forward Rendering, when drawing one object, after running the vertex shader, the pixel shader calculates lighting for each affected light. It works extremely fast when there are few lights in the scene, but as the number of lights (L) and the number of drawn objects (M) increases, the amount of computation increases exponentially, resulting in a computational cost of **`O(M × L)`**.

To prevent this, many mobile games and optimized projects either severely limit the maximum number of real-time lights that can affect a single object (e.g. to a maximum of 4) or utilize "lightmaps" that pre-bake all static lighting, such as static terrain, into textures to minimize the occurrence of dynamic calculation passes.

Advantages and disadvantages of Forward Rendering

Advantages (what you're good at) Disadvantages (things I don't like)
Perfect rendering of translucent objects Unable to process a large number of real-time light sources (extremely heavy)
MSAA works natively and looks beautiful Useless pixel calculation (calculation for parts that are hidden behind and cannot be seen) occurs
Low memory consumption and stable operation on mobile devices When materials are disjointed, draw calls tend to increase

Selection criteria in practice

Typical situations where technical artists should use Forward Rendering are as follows.

  • A project for devices with limited graphics bandwidth and mobile GPU performance, such as smartphones and Nintendo Switch.
  • VR games: In VR, strong anti-aliasing (MSAA) is essential to suppress screen flickering, and Forward Rendering is most compatible.
  • A game in which "semi-transparent" expressions such as water, glass, and effects occupy most of the screen.

The following is C# code for programmatically optimizing and controlling the maximum number of additional dynamic lights according to device performance in Unity's URP.

using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;

public class RenderPipelineOptimizer : MonoBehaviour
{
    void Start()
    {
        UniversalRenderPipelineAsset urpAsset = GraphicsSettings.currentRenderPipeline as UniversalRenderPipelineAsset;

        if (urpAsset != null)
        {
            #if UNITY_ANDROID || UNITY_IOS
            urpAsset.additionalLightsRenderingMode = LightRenderingMode.Disabled;
            urpAsset.supportsHDR = false;
            #else
            urpAsset.additionalLightsRenderingMode = LightRenderingMode.PerPixel;
            urpAsset.maxAdditionalLightsCount = 4;
            urpAsset.supportsHDR = true;
            #endif
        }
    }
}

Forward rendering is a classic, but in today's mobile era, it is the most reliable and sophisticated tunable technology. Understanding how drawing algorithms work and combining them with proper light control can create great gaming experiences that run smoothly and with low power consumption.