SceneViewExtensionによるレンダリング改造の紹介

1.1K Views

October 20, 24

スライド概要

講演者:なが

「Unreal Engine Meetup Connect - Vol.4 - TA編」の講演資料です。

アーカイブ動画:
https://youtu.be/Z6OSqWo2UxI

イベントページ:
https://leon-gameworks.connpass.com/event/328282/

profile-image

Unreal Engine をメインとするゲーム会社、株式会社Leon Gameworks のアカウントです。

シェア

またはPlayer版

埋め込む »CMSなどでJSが使えない場合

関連スライド

各ページのテキスト
5.

描画処理ブロック 内部パスA 中間結果 内部パスB 最終結果

6.

BasePass LightingPass PostprocessPass 皆さんのモニタへ

9.

ざんねん

12.

なんかある…

14.

それはそれとして(゜.゜)

19.

UEレンダリングパイプライン UE RenderPassA UE RenderPassB CustomProcess SceneViewExtension拡張

20.

BasePass LightingPass CustomProcess

21.

TranslucencyPass PostprocessPass CustomProcess

23.

UEレンダリング構築用オブジェクト(後述) カメラ等のView情報 レンダーターゲット群 アクセスできるテクスチャ群 Gbuffer, SceneColor等

24.

TranslucencyPass PostprocessPass CustomProcess SceneColor SceneColor 引き続きUEレンダリングの SceneColorとして使われる SceneColor カスタム処理でSceneColorに 追加書き込み

25.

SceneColorやDepth GBuffer CustomDepthStencil

29.

RDG構築オブジェクト RDG構築オブジェクトに描画処理を登録

30.

https://levelup.gitconnected.com/organizing-gpu-work-with-directed-acyclic-graphs-f3fd5f2c2af3

32.

UE5 RenderDoc Capture Activision Rendering Engine https://research.activision.com/publications/2023/06/Task-Graph-Renderer-at-Activision

33.

UE5 RenderDoc Capture Activision Rendering Engine Activision 描画タスク数 236個! https://research.activision.com/publications/2023/06/Task-Graph-Renderer-at-Activision

35.

プログラマが手作業で できる規模じゃない… https://research.activision.com/publications/2023/06/Task-Graph-Renderer-at-Activision

36.

システマチックに解決したい! RenderGraph https://research.activision.com/publications/2023/06/Task-Graph-Renderer-at-Activision

37.

https://levelup.gitconnected.com/organizing-gpu-work-with-directed-acyclic-graphs-f3fd5f2c2af3 https://logins.github.io/graphics/2021/05/31/RenderGraphs.html

38.

UE使用者のRDGの操作はここ

39.

このあたりがリソース依存関係 このあたりが処理の登録部

40.

RDGBuilder ここまでのUE描画パスが登録されている 独自のシェーダでDraw処理を登録 Copy等は登録関数が Utilityにある

41.

TranslucencyPass PostprocessPass CustomProcess SceneColor SceneColor 引き続きUEレンダリングの SceneColorとして使われる SceneColor カスタム処理でSceneColorに 追加書き込み

43.

CustomProcess エッジ合成 SceneColor SceneColor “RDG作業テクスチャ” エッジ抽出結果

44.

例)ComputeShader HLSL 例)ComputeShader Dispatchの登録

50.

SceneColor 高輝度抽出シェーダ BrightTexture (Local)

51.

BrightTexture (Local) Ghost生成シェーダ GhostTexture (Local) 引用 https://john-chapman-graphics.blogspot.com/2013/02/pseudo-lens-flare.html

52.

GhostTexture (Local) Ghost合成シェーダ SceneColor

56.

引用 https://www.kyprianidis.com/p/pg2009/jkyprian-pg2009.pdf

58.

SceneColor 勾配計算シェーダ EdgeTexture (Local)

59.

EdgeTexture (Local) ブラーシェーダ BlurEdgeTexture (Local)

60.

BlurEdgeTexture (Local) 異方性計算シェーダ AnisotropyTexture (Local)

61.

SceneColor コピー処理 SceneColorCopy (Local) AnisotropyTexture (Local) 異方性計算シェーダ SceneColor

64.

SceneColor 合成パス SceneColor コピーテクスチャ作成 & コピー 前フレームの ”抽出”から PrevCopySceneColor 次フレームへ ”抽出” CopySceneColor

65.

// 前フレームで抽出して保持していたHistoryTextureをRDG管理下に登録, PrevHistoryTexture = GraphBuilder.RegisterExternalTexture(HistoryTexture); // TODO. // PrevHistoryTextureを使った描画処理 // 次のフレームへ伝搬させるためのテクスチャをRDGで作成. NewHistoryTexture = GraphBuilder.CreateTexture(WorkOutputDesc, TEXT(“DebugTextureName")); // ~~ // TODO. // NewHistoryTextureに次のフレームへ伝搬させる内容を描画. // ~~ // NewHistoryTextureを抽出してRDG管理から取り出し, HistoryTextureとして保持. GraphBuilder.QueueTextureExtraction(NewHistoryTexture, &HistoryTexture);

70.

const uint custom_shadingmodel_id = 15; FMaterialAttributes out_attr = (FMaterialAttributes)0; out_attr = FMaterialAttributes_SetShadingModel(out_attr, uint(custom_shadingmodel_id)); return out_attr;

72.

GBufferBコピー 元からUnlit ShadingModel=0 ShadingModel=15 GBufferB GBufferB シェーダで書き換え ShadingModel=0 コピー処理 ShadingModel書き換え シェーダ GBufferBCopy (Local) GBufferB