Before we start

image

A hard question

The reason I am writing this article is because a friend of mine asked me a question: how does Unreal Engine 5.2 render a cube? I was initially intrigued by the question and attempted to answer it right away, but unfortunately I wasn't able to give a clear answer. I felt a little embarrassed admitting my lack of knowledge, but I knew how important it was to provide accurate and detailed information.

So, I asked my friend to give me some time to research the topic and find a clear answer. As I delved deeper into the complex world of Unreal Engine, I realized that the answer was not as straightforward as I had initially thought. The more I read, the more intrigued I became. I decided to compile all of my research into a set of articles, in order to provide a comprehensive overview of how Unreal Engine 5.2 renders a cube.

This article is the first installment of that series. In it, I will explore the fundamentals of Unreal Engine 5.2 rendering and dive into the intricate details of the rendering pipeline. I will discuss the different techniques that are used to render objects, and explain how these techniques are combined to create realistic and visually stunning graphics.

I hope that this article will be helpful for anyone who is interested in game development, computer graphics, or simply curious about how Unreal Engine 5.2 works. By the end of this article, you will have a better understanding of the rendering process and the role it plays in creating immersive gaming experiences.

icon
Important message: I am not a developer at Epic Games, which means that all the information provided is based solely on my own understanding and may contain misunderstandings or mistakes, particularly regarding the original intentions behind the designs. If you notice any errors, please let me know so I can correct them.

Explanation Order

First, I will explain the data view, which includes the classes and their relationships. This will provide a 'static' map of the system.

Then, I will explain the processing details, starting from the beginning. This will give you a dynamic animation of how all the objects cooperate.

Environment

Since unreal engine supports a lot of platforms, to simplify my explaination, I only talk about one case:

  • Hardware
    • RTX 4080 GPU
  • RHI : DirectX 12
  • OS : Windows

Detail Level

To avoid getting sidetracked and losing track of our progress, I will be brief in my explanations and focus on the most important implementation details. Specifically, I will cover the aspects related to rendering a single static cube.

So, if you read the early articles, and want to say ‘wait, this is not true, you forget to mention XXX class’, I think:

  • You are an expert, really thanks for reading this.
  • Try to ignore the ‘low-frequency’ description, it is not for you, and continue your reading. They may be mentioned later.

Let’s assume the unreal engine is a complex and high frequency model. Compared with describe every details from the beginning to the end:

image

I think people may better understand by explain from low-frequency to high.

image

One of my favorite books, La Formule du Savoir: Une philosophie unifiée du savoir fondée sur le théorème de Bayes, includes the following quote:

"Every model is wrong, but some of them are more useful."

The idea is that, while no model or representation of reality can be completely accurate, some models can still be very useful in helping us understand and navigate the world around us. Similarly, when it comes to information and data, it's important to have a global map and an appropriate level of detail in order to make sense of things effectively.

Symbols and Conventions

Source Code Reference

In the text, you will see many source code references written in this format:

This link points to a section of code in the official Unreal Engine GitHub source code repository.

image

If you click and find that you cannot access, it may be because you do not have access to Unreal Engine source code. Please follow the official documentation below to obtain access:

If you are unable to access GitHub for some reason, you can follow the path shown in the text to search for the corresponding files and functions in your Unreal Engine source code.

Tools

Compared to just reading this e-book, I suggest that readers can personally capture and debug to further analyze the parts that interest them.

The following are the tools used in writing this book:

You may need to enable UE's shader debug mode to see more information about the shader.

  • Open the engine installation directory’s config folder \Engine\Config
  • Modify ConsoleVariable.ini and uncomment the following content:
r.Shaders.Optimize=0
r.Shaders.Symbols=1
  • When running your UE project with tools like PIX, use the following configuration:
image