-
Notifications
You must be signed in to change notification settings - Fork 428
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
Bake smoothness and roughnessFactor into textures. #222
Bake smoothness and roughnessFactor into textures. #222
Conversation
…nd roughnessFactor as hardcoded-value 1.0 in Unity world (Resolve #212)
対応はっや!試してみます! |
ウオオーーーーいけたー!ありがとうございます! |
a = (byte)(255 - src.g), | ||
// Bake roughness values into a texture. | ||
// See: https://github.com/dwango/UniVRM/issues/212. | ||
a = (byte)(255 - Math.Min(src.g * (1.0f - _smoothness), 255)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
こちら、 roughness = 1.0 - smoothness
でなく、
roughness = (1.0 - smoothness)^2
とのことですので、修正をお願いします。
以下のような要因で即時の変更が難しい場合、次のPRにまわしていただいても構わないです。
- UniGLTF全編に対する変更が必要なこと
- エクスポート結果が変化すること(正しくはなります)
こちらの記事を参考にどうぞ。
Roughnessは学術的に確立されたパラメータではあるものの、視覚的変化が線形でないため、
SmoothnessというRoughnessを一段覆うパラメータが生まれたようです。
https://blogs.unity3d.com/jp/2016/01/25/ggx-in-unity-5-3/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
おお、ありがとうございます!変更いたします。記事も参考になります 🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
c8489af で対応しました。Import/Exportの段階ですべて変換してしまう方針です。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
計算間違えているので修正します...
|
||
var pixelSmoothness = src.a * _smoothnessOrRoughness; // smoothness | ||
// https://blogs.unity3d.com/jp/2016/01/25/ggx-in-unity-5-3/ | ||
var pixelRoughnessFactor = (1.0f - pixelSmoothness) * (1.0f - pixelSmoothness); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var pixelRoughnessFactor = (1.0f - pixelSmoothness) * (1.0f - pixelSmoothness); | |
var pixelRoughnessFactorSqrt = (1.0f - pixelSmoothness); | |
var pixelRoughnessFactor = pixelRoughnessFactorSqrt * pixelRoughnessFactorSqrt; |
めちゃ細かいですが……w
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
対応ありがとうございます 🙏
式の修正、レビュー対応済みです。 |
Resolve #212.
Now some conversion logic are introduced when converting MetallicRoughness maps.
Unity world to glTF world
smoothness
value is baked into exported textures when exportingroughnessFactor
is hard-coded as1.0f
in glTF (because this values are already baked into textures)glTF world to Unity world
roughnessFactor
value is baked into imported textures when importingsmoothness
is hard-coded as1.0f
in Unity (because this values are already baked into textures)