ue4-shader-カスタムテンプレートCustomStencil
Ue4 Shader Custom Template Customstencil
タイトル:ue4-shader-カスタムテンプレートCustomStencil
カテゴリ:UnrealEngine4-シェーダー
タグ:[ue4、シェーダー、ステンシル、テンプレートテスト]
日付:2019-05-09 21:00:50
コメント:false
カスタム深度ステンシルは、カスタム深度の拡張です。カスタム深度ステンシルは、カスタム深度の拡張です。
前日譚
- 公式ドキュメント:CustomDepth Stencil- https://docs.unrealengine.com/en-US/Engine/Rendering/PostProcessEffects/PostProcessMaterials
- UnrealEngineでのマルチカラーアウトライン後処理4- http://www.tomlooman.com/multi-color-outline-post-process-in-unreal-engine-4/
ハンドブック
-
プロジェクトはテンプレートテストを開きますが、デフォルトでは閉じられています。 プロジェクト設定->エンジン->レンダリング->後処理->カスタム深度ステンシルパス 、 選択する ステンシルで有効
-
テンプレート値をオブジェクトに割り当てます。に メッシュ コンポーネントの下で検索 レンダリング 、
ダニ customDepthパスをレンダリングする 、与える customDepthステンシル値 テンプレート値を指定する 180 (カスタマイズ)
-
C ++を使用している場合、関連するコード
GetMesh()->SetRenderCustomDepth(true) GetMesh()->SetCustomDepthStencilValue(255) // assign an int32 within 1-255 range.
-
あなたはそれをチェックすることができます。 点灯->バッファの視覚化->カスタムステンシル
-
テストの概要
参考:アウトライン効果(パート1)- https://www.parallelcube.com/2017/12/05/outline-effect-part-1/
-
レンダリング
-
これは 後処理 素材、マッチ 後処理量 使用する
-
カスタムノードコード。役割は、画面のピクセルに対応するバッファをオフセットしてからフラッシュすることです GBuffer テンプレート値を取得します。
GetScreenSpaceData 機能はすることができます GBuffer データを取得します。これは パイプラインの遅延 関数。参照: ベースパスピクセルシェーダー
#if SCENE_TEXTURES_DISABLED return 0 #endif float offset_h = SceneTexelSize.r * Thickness float offset_v = SceneTexelSize.g * Thickness float TL = GetScreenSpaceData(ViewportUVToBufferUV(ScreenPosition + float2(-offset_h, -offset_v)), false).GBuffer.CustomStencil.r float TM = GetScreenSpaceData(ViewportUVToBufferUV(ScreenPosition + float2(0, -offset_v)), false).GBuffer.CustomStencil.r float TR = GetScreenSpaceData(ViewportUVToBufferUV(ScreenPosition + float2(offset_h, -offset_v)), false).GBuffer.CustomStencil.r float ML = GetScreenSpaceData(ViewportUVToBufferUV(ScreenPosition + float2(-offset_h, 0)), false).GBuffer.CustomStencil.r float MR = GetScreenSpaceData(ViewportUVToBufferUV(ScreenPosition + float2(offset_h, 0)), false).GBuffer.CustomStencil.r float BL = GetScreenSpaceData(ViewportUVToBufferUV(ScreenPosition + float2(-offset_h, offset_v)), false).GBuffer.CustomStencil.r float BM = GetScreenSpaceData(ViewportUVToBufferUV(ScreenPosition + float2(0, offset_v)), false).GBuffer.CustomStencil.r float BR = GetScreenSpaceData(ViewportUVToBufferUV(ScreenPosition + float2(offset_h, offset_v)), false).GBuffer.CustomStencil.r return max(TL, max(TM, max(TR, max(ML, max(MR, max(BL, max(BM, BR ) ) ) ) ) ) )
-
-
補助理解図
結局、交点だけがストローク領域である1の値になります。 lerp関数0は元の色、1はストロークの色です。