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

UniVRM0.54以降で BaseColorFactor の Linear 変換が入ったので、過去にエクスポートしたモデルが 白っぽくなったり、黒っぽくなったり、見た目が以前と異なってしまうものがある #375

Closed
fantom1x opened this issue Feb 6, 2020 · 3 comments
Assignees
Labels
colorspace gamma(sRGB) / Linear
Milestone

Comments

@fantom1x
Copy link
Contributor

fantom1x commented Feb 6, 2020

バグについて

たぶん以下のIssueの関連の気がしますが(同じならまとめちゃって下さい)
#369
「Standard Shader」でも白っぽくなり(輝度が異様に高くなる?)、以前と見た目がかなり変わってしまうものがあるので、レポートとして挙げておきます。

再現方法

例えば、以下URLの素材をロードする(エディタでも可)。

期待する動作

UniVRM0.53のスクリーンショットのように白っぽく(黒っぽく)ならない。

スクリーンショット

お花見セット (GLB ※拡張子を.glbに変えて下さい)
https://hub.vroid.com/characters/637505527785006989/models/1628906739367953109

(UniVRM0.53)
hanami_0_53

(UniVRM0.55)
hanami_0_55

sea of star (GLTF)
https://sketchfab.com/3d-models/sea-of-star-71c898a3e6ca4bbab6e2ae6b47c97798

(UniVRM0.53)
sea_of_star_0_53

(UniVRM0.55)
sea_of_star_0_55

Hampton Lake Dam (GLTF)
https://sketchfab.com/3d-models/hampton-lake-dam-post-hurricane-irma-a28144252dc74062a40672b5de3b7120

(UniVRM0.53)
dam_0_53

(UniVRM0.55)
dam_0_55

環境情報

  • OS: Windows 10 (x64)
  • UniVRM version: 0.53-0.55
  • Unity 2019.2.18f1-2.20f1
@hiroj
Copy link
Contributor

hiroj commented Feb 6, 2020

#301
#339
上記の修正によってUniVRM0.54から Gltf の BaseColor をUnityに読み込む時にGamma変換が入るようになりました。
UniVRM0.53以前では、UnityのColor値(sRGB)をそのまま入出力していましたが、GltfではColor値はLinearで書き込む仕様であることが判明したためバグとして修正が入っています。
Import : GltfLinear -> UnitysRGB
Export : UnitysRGB -> GltfLinear
この修正の影響として、StanderdとUnlitを使用してかつ Color が(1, 1, 1)or(0, 0, 0)以外を設定したUniVRM0.53以前のモデルの色がご報告して頂いた通り変わります。
MToonの Color は Gltf の BaseColor を参照していないため影響はありません。
対策としてUniVRM0.53以前で出力されたモデルはsRGB変換を行わない等の検討を致します。
(ただちゃんとsRGB変換している他のライブラリで読み込んだ場合はやはり色が変わっているはずなので、UniVRM限定の局所的対応にはなってしまいます)

@fantom1x
Copy link
Contributor Author

fantom1x commented Feb 6, 2020

なるほど、仕様的な問題なのですね。詳しい情報を有難うございます。

確かに、キャラクターモデルで影響受けてるのはあまり見かけませんね(MToonを使っているものが多いが、たまにStandard/Unlitを使っているものもある)。「Color が(1, 1, 1)or(0, 0, 0)以外」という条件もあるからでしょうか。そうなると少なくもなるか…。🤔

まぁ、背景モデルに関しては、かなり作者の制作環境(ツール等)に依存するので、ある程度は諦めるしかないかもですね。「sRGB変換を行わない」実装を待つことにします(ランタイム時にロードオプションみたいにできれば汎用的に使えそうですが)。

* * * * * * * * * *

キャラとは言い難いですが、以下のようなモデルは影響受けてますね…。ご参考までに(笑)。
Dragon
https://hub.vroid.com/characters/8819627042892951588/models/6009718067118488885

(UniVRM 0.53)
dragon_0_53
(UniVRM 0.55)
dragon_0_55

Cerberus
https://hub.vroid.com/characters/256837281355081925/models/6703438975281016999

(UniVRM 0.53)
cerberus_0_53

(UniVRM 0.55)
cerberus_0_55

@hiroj
Copy link
Contributor

hiroj commented Feb 6, 2020

UniVRM0.54以降であれば、エクスポート時にLinear変換されたColorが出力されるため、これをUnityにインポートするとsRGBに再変換されて値が元に戻り、エクスポートした時と同じ色になります。

  • Unity上のBaseColor: (0.5, 0.5, 0.5, 0.5)
    ↓Linear変換する
  • Gltfに書き込まれるBaseColor: (0.217637, 0.217637, 0.217637, 0.5)
    ↓sRGB変換する
  • Unityに読み込まれた後のBaseColor: (0.5, 0.5, 0.5, 0.5)

WebGLについてはそこまで詳しくないのですが、VRoidHub上の色がUniVRM 0.53の表示と同じになっているということは、VRoidHubも同じ問題を抱えている可能性がありますね・・・(BaseColorFactorをsRGBとして扱っているかもしれない)

@hiroj hiroj added this to the v0.56 milestone Jun 1, 2020
@hiroj hiroj self-assigned this Jun 1, 2020
@hiroj hiroj modified the milestones: v0.56, v0.57 Jul 6, 2020
@hiroj hiroj modified the milestones: v0.57, v0.58 Jul 27, 2020
@hiroj hiroj modified the milestones: v0.58, v0.59 Aug 17, 2020
@hiroj hiroj modified the milestones: v0.59, v0.60 Aug 31, 2020
@ousttrue ousttrue modified the milestones: v0.60, v0.999 Sep 14, 2020
@ousttrue ousttrue changed the title UniVRM0.54以降でGLTF/GLBをロードすると、白っぽくなったり、黒っぽくなったり、見た目が以前と異なってしまうものがある UniVRM0.54以降で BaseColorFactor の Linear 変換が入ったので、過去にエクスポートしたモデルが 白っぽくなったり、黒っぽくなったり、見た目が以前と異なってしまうものがある May 31, 2021
@ousttrue ousttrue added the colorspace gamma(sRGB) / Linear label Sep 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
colorspace gamma(sRGB) / Linear
Projects
None yet
Development

No branches or pull requests

3 participants