Our Journey Begins
How can we render a cube in unreal engine 5?
A simplest answer will be: let’s drag and drop a cube to the scene.
That's a great answer! Essentially, what you did was:
- Add a
StaticMeshActor
to the current scene - This actor contains one instance of
UStaticMeshComponent
Why is this static mesh component instance a cube instead of a sphere?
This is because we set the static mesh member variable to the cube static mesh.
Why is this cube white?
It is because we set a BasicShapeMaterial
into the first element of the material array in this static mesh component.
Let’s do a summary:
Of course, to lighting our cube, we also need to put a light into the scene, let’s add a point light.
That’s all, you already see a beautiful cube!
Question
However, please carefully observe this image and consider the following question:
How is the value of each pixel on this image determined?
In other words, if we zoom in on this image, we will find that the RGB value of this pixel is: 199,199,199
How is this value, as well as the RGB values of each pixel, calculated?
This is what this long book tries to answer.
Answer, and the structure of the chapters
To answer the above question, we need to analyze the rendering structure of Unreal Engine layer by layer.
Starting from this chapter, we will divide into 2 branches:
- Asset Branch: Talk about this part
- Runtime Branch: Talk about this part
With the following chapters:
With the following chapters: