中EN

Graphics Programming Overview

注意:该页虽标注 5.8,但部分内容(drawing policies、static draw lists、"-dx12 experimental"、SM4)明显沿袭 UE4 时代文字,可能已过时。

  • Start reading at FDeferredShadingSceneRenderer::Render (rendering thread); use profilegpu and search draw event names.
  • stat unit: frame, game thread, rendering thread, GPU times; "Whichever is the longest is the bottleneck. However, GPU time contains idle time, so is only the bottleneck if it is the longest and stands alone." profilegpu (Ctrl+Shift+;) measures GPU timings for the view. vis/VisualizeTexture; show x; pause (continues rendering); slomo.
  • Renderer is its own module; Engine calls Renderer via IRendererModule / FSceneInterface.
  • Scene = primitive components + FScene; an Octree of primitives for accelerated spatial queries.
  • Rendering Thread operates in parallel with game thread; classes split by thread ownership: UWorld <-> FScene; UPrimitiveComponent <-> FPrimitiveSceneProxy / FPrimitiveSceneInfo; ULightComponent <-> FLightSceneProxy/Info; ULocalPlayer <-> FSceneViewState; FSceneView/FViewInfo constructed per frame; FSceneRenderer per-frame temporaries. Game thread owns UPrimitiveComponent state; rendering thread should not access it directly; FScene owned by rendering thread. Call MarkRenderStateDirty() to propagate changes.
  • "Primitive components are the basic unit of visibility and relevance determination"; occlusion and frustum culling per primitive; bounds used for culling, shadow casting, light influence; think about how big to make components.
  • FPrimitiveViewRelevance = logical OR of elements' relevance.
  • Dynamic rendering path: flexible, minimal insertion cost, high traversal cost, no state sorting. Static path: caches at attach time; "Static draw list rendering is about 3x faster on the rendering thread for Static Meshes"; only view-independent state.
  • High-level order from FDeferredShadingSceneRenderer::Render: allocate scene RTs -> InitViews (visibility via culling, dynamic shadow setup) -> PrePass/Depth only (initialize Hierarchical Z to reduce base pass shading cost) -> Base pass (opaque & masked to GBuffer; lightmap and sky lighting to scene color) -> Occlusion queries (bounding boxes, used by next frame's InitViews) -> Lighting (shadow maps per light; "mix of standard deferred and tiled deferred shading"; translucency lighting volumes) -> Fog (deferred per-pixel) -> Translucency (offscreen RT, per-vertex fog; lit translucency single pass) -> Post Processing.
  • RHI: thin layer above platform API, "as low level as possible"; feature levels SM5, SM4, ES3_1.

引用这一章的笔记

输入关键词开始搜索

滚轮或双指缩放 · 拖动平移 · 双击放大 / 还原