<aside> <img src="/icons/layers_blue.svg" alt="/icons/layers_blue.svg" width="40px" /> FSceneRenderer::ComputeViewVisibility

</aside>

Do we need to render everything in the scene?

No, because:

So let’s talk about the culling.

Actually, in unreal engine, Epic Games chose the word Relevance . But to keep the title easy to understand I still use ‘Culling'.

View

Before we talk about the culling, we need to think about the culling is based on what. If we have two camera views, we need to execute the culling for each camera view.

Image from : https://www.youtube.com/watch?v=9XnfvWayuzA

Image from : https://www.youtube.com/watch?v=9XnfvWayuzA

So the culling precedural is view-based. Let’s look at the FViewInfo

graph TD
  FSceneRenderer --n--> FViewInfo["FViewInfo ViewInfos"]
	subgraph FViewInfo["FViewInfo ViewInfos"]
		PrimitiveVisibilityMap["FSceneBitArray PrimitiveVisibilityMap"]
	end

The scene renderer may need to render more than one view in one frame (for example, split screen), so it contains an array of FViewInfo.

Primitive Culling

In this step, it will do Frustum Culling and Distance-based culling in parallel.

graph TD
  SceneRenderer--> ParallelFor([ParallelFor]) --> FC["Frustm Culling"] --Pass--> DC[Distance Culling] --Not Pass--> PM
ParallelFor([ParallelFor]) --> FC1["Frustm Culling"] --Pass--> DC1[Distance Culling] --Pass--> PM1
subgraph PrimitiveVisibilityMap
 PM["[Primitive 0]-->False"]
 PM1["[Primitive 1]-->True"]
end

Data Structure and Relationship

The result will be write into View.PrimitiveVisibilityMap