Fix Suggenstion for HDRP

オープン
#721 コメント 0 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
csharp, unity
領域
game-dev

調査の方向性

Runtime/Shaders/ShaderGraph/PBRHelpers.cgincから始め、特にプレビュー条件と、issueで説明されているSampleSceneColor関数を確認します。次に、HDRPを使用するUnity 2022.3.12でPBRGraph.shadergraphを調べ、関連するシェーダーキーワードとGraph Inspectorの設定を確認します。HDRPマテリアルがピンクでレンダリングされなくなり、シェーダーがコンパイルされ、グラフが要求されたsurfaceおよびclippingのデフォルト値を使用すれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Version 2.10.0-rc displays pink materials with HDRP and Unity 2022.3.12. Below is a suggested fix, and I hope you will find helpful.

In line 3 of PBRHelpers.cginc:
https://github.com/KhronosGroup/UnityGLTF/blob/20b7493dbd6039fe2fd88e7c5a564ab3bd72734d/Runtime/Shaders/ShaderGraph/PBRHelpers.cginc#L3

SHADERGRAPH_PREVIEW must be replaced by another ShaderKeyword used in HDRP, such as SHADERPASS_FORWARD, because it has been removed in the current version of HDRP. Note that SHADERPASS_FORWARD is just an example.
Reference: https://issuetracker.unity3d.com/issues/shadergraph-number-if-shadergraph-preview-in-a-custom-function-node-throws-error

The two functions, SampleSceneColor_float and SampleSceneColor_half, from lines 52 to 72 in PBRHelpers.cginc:
https://github.com/KhronosGroup/UnityGLTF/blob/20b7493dbd6039fe2fd88e7c5a564ab3bd72734d/Runtime/Shaders/ShaderGraph/PBRHelpers.cginc#L52-L72
should be nested out of the conditional #if defined(USE_CAMERA_OPAQUE), as this conditional is not executed when HDRP is enabled.

Additionally, for improved convenience, within the Graph Inspector of PBRGraph.shadergraph, HDRP's Surface Type should be Opaque instead of Transparent and Alpha Clipping should be enabled as it is frequently used in many materials.

主要言語
C#
スター
2.3k
フォーク
539
平均マージ
3日 15時間
マージ済み PR(30日)
2

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

KhronosGroup/UnityGLTF のほかの issue

KhronosGroup/UnityGLTF の issue をすべて見る

似ている issue

C# の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。