Repository navigation
Conversation
マテリアルの色のTarget Valueは、常にHDRではないカラー ピッカーで描かれていた。そのため、MToonの_EmissionColor のように[HDR]付きで宣言されたプロパティでも、1.0を超える 値を入力できなかった。 データ(Vector4)、実行時の合成、書き出しと読み込みは、 もともと1.0を超える値をそのまま扱う。入力を制限して いたのはインスペクタだけだった。 シェーダーのプロパティのフラグを調べ、[HDR]が付いて いればHDRのカラーピッカーを使う。付いていないプロパティ の表示は変わらない。
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
VRM-0.X の BlendShapeClip のインスペクタで、マテリアルの色の Target Value を
HDR で入力できるようにします。対象は、シェーダーで
[HDR]付きで宣言されているプロパティだけです(MToon では
_EmissionColor)。問題
BlendShapeClipEditorHelper.ColorPropがEditorGUI.ColorField(rect, label, value)を使っているため、常に HDR ではないカラーピッカーが出ます。
MToon の
_EmissionColorは[HDR]付きで宣言されていますが、表情で 1.0 を超えるエミッションを指定できません。
入力を制限しているのはインスペクタだけでした。
materialValues[].targetValueは number の配列で、範囲の制限がありませんMaterialValueBinding.TargetValueはVector4ですMaterialValueBindingMergerは値を丸めずに補間しますTargetValueをそのまま配列に変換しています変更
ShaderPropertyFlags.HDR)を調べるIsHdrColorPropertyを追加しました[HDR]が付いているときだけ、EditorGUI.ColorFieldのhdrを true にします[HDR]が付いていないプロパティ(_Colorなど)の表示は変わりません変更は
BlendShapeClipEditorHelper.csの1ファイルだけです。確認したこと
このブランチ(v0.131.4 + この変更)を、Unity 2022.3.62f2 の Built-in RP の
プロジェクトから参照して確認しました。
_EmissionColorの Target Value で Intensity を指定できること。_Colorでは従来どおりのカラーピッカーが出ること(例:
"targetValue": [0, 2.555405, 9.849154, 1]、exporterVersionはUniVRM-0.131.4)この PR はインスペクタの描画だけを変えるもので、書き出しと読み込みのコードには
触れていません。
関連
VRM-1.0 の Expression のエディタ(
ExpressionEditorHelper.ColorProp)にも同じ実装があります。そちらは別の PR で提案します。