Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VRMを出力する際の色情報について #301

Closed
iCyP opened this issue Aug 20, 2019 · 4 comments
Closed

VRMを出力する際の色情報について #301

iCyP opened this issue Aug 20, 2019 · 4 comments
Labels
bug Something isn't working colorspace gamma(sRGB) / Linear
Milestone

Comments

@iCyP
Copy link
Contributor

iCyP commented Aug 20, 2019

バグについて
https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#pbrmetallicroughnessbasecolorfactor
gltfマテリアルの仕様では色情報について、リニアであるとされています。
しかし、VRMに出力されている色情報は、gltf、VRM拡張共にカラーピッカーそのままの値、つまりsRGB空間で保存されています。

再現方法
MToonの色設定を(0.5,1,1,1)でVRMを出力します。
VRM出力時に期待される色情報はおおむね(0.21586,1,1,1)になりますが、gltf、VRM拡張共のjsonには(0.5,1,1,1)で記録されています。

環境情報

  • OS: [Windows 10]
  • UniVRM version: [0.53.0]
@0b5vr
Copy link
Contributor

0b5vr commented Aug 21, 2019

インポート側もリニアとして入力する必要がありそうですね。
色情報について、 vectorProperties と分けて管理するのも併せて検討お願いします。

@hiroj hiroj added this to the v0.54 milestone Aug 22, 2019
@hiroj hiroj added the bug Something isn't working label Aug 22, 2019
@hiroj
Copy link
Contributor

hiroj commented Aug 30, 2019

ご報告ありがとうございます、詳しく確認したところ以下のような状態になっていました。

通常の Color Property の RGB Channel

  • UnityのMaterial に記録されている値はsRGBなので、 sRGB2Linear で変換して書き込む必要がある
  • MToon該当: Lit Color, Shade Color, Outline Color

HDR Attribute 付き Color Property の RGB Channel

  • このAttribute が付いている場合はUnityのMaterial に記録されている値がLinearになっているため、変換せずに書き込む
    • Material に記録されている値 0.5 (Linear)
    • Inspector 上のプレビュー 0.73 (sRGB)
    • Shader に渡される値 0.5 (Linear) (無変換)
  • MToon該当: Emission Color, Rim Color

普通/HDR の Alpha Channel

  • どちらの場合もLinearであったため変換なしで書き込む

この件の対応として、gltfの領域に書き込まれているColor 値に関しては次のUniVRMバージョンで修正し、VRM(MToon)の領域に関しては specification=0.0 では今の状態を仕様とし、Material拡張対応(#175)と合わせて1.0で修正するissueを切ります。

@hiroj
Copy link
Contributor

hiroj commented Dec 13, 2019

#339
baseColorFactorをExportする時にLinearに変換するように修正しました

@hiroj
Copy link
Contributor

hiroj commented Dec 18, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working colorspace gamma(sRGB) / Linear
Projects
None yet
Development

No branches or pull requests

4 participants