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

matcapTexture should be 0.0 when it doesn't exist. #2540

Merged
merged 3 commits into from
Dec 23, 2024

Conversation

Santarh
Copy link
Contributor

@Santarh Santarh commented Dec 23, 2024

Fixed #2505

仕様によれば、matcapTexture が指定されていないとき 0.0 として評価されるべきです。

When the texture is not defined, it must be sampled as having 0.0 in RGB components.
https://github.com/vrm-c/vrm-specification/tree/master/specification/VRMC_materials_mtoon-1.0#matcaptexture

つまり matcapFactor の値がなんであれ、matcapTexture が指定されていないときは MatCap 項自体が 0.0 となるべきだということです。
しかし現状は matcapFactor の値が評価されていました。
これを修正します。

またあわせて matcapFactor のデフォルト値も仕様に合わせて変更します。
Material 新規作成時のデフォルト値が変わりますが、新規モデル制作時の話であり、その場合も見た目の挙動は変わりません。

default: [1, 1, 1]
https://github.com/vrm-c/vrm-specification/tree/master/specification/VRMC_materials_mtoon-1.0#matcapfactor

@@ -118,7 +118,7 @@ inline half3 GetMToonLighting_Rim_Matcap(const MToonInput input)

return _MatcapColor.rgb * MTOON_SAMPLE_TEXTURE2D(_MatcapTex, matcapUv).rgb;
}
return _MatcapColor.rgb;
return 0;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the texture is not defined, it must be sampled as having 0.0 in RGB components.

https://github.com/vrm-c/vrm-specification/tree/master/specification/VRMC_materials_mtoon-1.0#matcaptexture

@@ -29,7 +29,7 @@ Shader "VRM10/MToon10"
_EmissionMap ("emissiveTexture", 2D) = "white" {} // Unity specified name

// Rim Lighting
_MatcapColor ("mtoon.matcapFactor", Color) = (0, 0, 0, 1)
_MatcapColor ("mtoon.matcapFactor", Color) = (1, 1, 1, 1)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

乗算するのでデフォルトは白

@ousttrue ousttrue merged commit c2a793c into vrm-c:master Dec 23, 2024
1 check passed
@Santarh Santarh deleted the matcapDefaultBehaviour branch December 23, 2024 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect matcap behaviour when only matcapFactor is set
2 participants