diff --git a/Assets/VRM10/Runtime/Migration/Materials/MigrationMToonMaterial.cs b/Assets/VRM10/Runtime/Migration/Materials/MigrationMToonMaterial.cs index d14bd3c65..8068dd0f3 100644 --- a/Assets/VRM10/Runtime/Migration/Materials/MigrationMToonMaterial.cs +++ b/Assets/VRM10/Runtime/Migration/Materials/MigrationMToonMaterial.cs @@ -298,7 +298,9 @@ namespace UniVRM10 break; case OutlineWidthMode.ScreenCoordinates: dst.OutlineWidthMode = UniGLTF.Extensions.VRMC_materials_mtoon.OutlineWidthMode.screenCoordinates; - dst.OutlineWidthFactor = mtoon.Definition.Outline.OutlineWidthValue * oneHundredth; + // NOTE: 従来は、縦幅の半分を 100% としたときの % の値だった。 + // 1.0 では縦幅を 1 としたときの値とするので、 1/200 する。 + dst.OutlineWidthFactor = mtoon.Definition.Outline.OutlineWidthValue * oneHundredth * 0.5f; break; default: throw new ArgumentOutOfRangeException($"OutlineWidthMode: {(int)mtoon.Definition.Outline.OutlineWidthMode}"); diff --git a/Assets/VRMShaders/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_geometry_vertex.hlsl b/Assets/VRMShaders/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_geometry_vertex.hlsl index 44dac0c9b..77dbc0167 100644 --- a/Assets/VRMShaders/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_geometry_vertex.hlsl +++ b/Assets/VRMShaders/VRM10/MToon10/Resources/VRM10/vrmc_materials_mtoon_geometry_vertex.hlsl @@ -49,12 +49,14 @@ inline VertexPositionInfo MToon_GetOutlineVertex(const float3 positionOS, const const half3 normalVS = MToon_GetObjectToViewNormal(normalOS); const half3 normalCS = TransformViewToProjection(normalVS.xyz); + const float clipSpaceHeight = 2.0f; const float widthScaledMaxMeter = 1.0f; + half2 normalProjectedCS = normalize(normalCS.xy); // NOTE: VR などの高視野角カメラでは、純粋な実装では太くなりすぎる. // よって 1m 以上離れたら、それ以上太くならないようにする. const half outlineWidthMultiplier = outlineWidth * min(positionCS.w, widthScaledMaxMeter); - normalProjectedCS *= outlineWidthMultiplier; + normalProjectedCS *= clipSpaceHeight * outlineWidthMultiplier; normalProjectedCS.x *= aspect; // NOTE: カメラ方向軸を向く法線を持つ頂点が XY 方向にだけずれると困るので、それを抑制する. normalProjectedCS.xy *= saturate(1 - normalVS.z * normalVS.z);