Asset and Game World

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.

image

That's a great answer! Essentially, what you did was:

  • Add a StaticMeshActor to the current scene
  • This actor contains one instance of UStaticMeshComponent
image

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.

image
image

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.

image
image

Let’s do a summary:

Top Layer: asset and game world
Top Layer: asset and game world

Of course, to lighting our cube, we also need to put a light into the scene, let’s add a point light.

image
image

That’s all, you already see a beautiful cube!

image

Question

However, please carefully observe this image and consider the following question:

How is the value of each pixel on this image determined?

image

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:

  1. Asset Branch: Talk about this part
  2. image
  3. Runtime Branch: Talk about this part
  4. image