From 5656214f72155306b40c2ddf0215aedd889a367d Mon Sep 17 00:00:00 2001 From: Masataka SUMI Date: Thu, 22 Sep 2022 21:17:14 +0900 Subject: [PATCH] Fix uv animation speed unit of vrm-1.0 --- .../VRM10/Runtime/IO/Material/Vrm10MToonMaterialExporter.cs | 4 +++- .../VRM10/Runtime/IO/Material/Vrm10MToonMaterialImporter.cs | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Assets/VRM10/Runtime/IO/Material/Vrm10MToonMaterialExporter.cs b/Assets/VRM10/Runtime/IO/Material/Vrm10MToonMaterialExporter.cs index f684739ae..7022c63cd 100644 --- a/Assets/VRM10/Runtime/IO/Material/Vrm10MToonMaterialExporter.cs +++ b/Assets/VRM10/Runtime/IO/Material/Vrm10MToonMaterialExporter.cs @@ -152,7 +152,9 @@ namespace UniVRM10 const float invertY = -1f; mtoon.UvAnimationScrollYSpeedFactor = context.UvAnimationScrollYSpeedFactor * invertY; } - mtoon.UvAnimationRotationSpeedFactor = context.UvAnimationRotationSpeedFactor; + // Speed unit Conversion + const float rotationPerSecToRadianPerSec = Mathf.PI * 2f; + mtoon.UvAnimationRotationSpeedFactor = context.UvAnimationRotationSpeedFactor * rotationPerSecToRadianPerSec; // Texture Transforms var scale = context.TextureScale; diff --git a/Assets/VRM10/Runtime/IO/Material/Vrm10MToonMaterialImporter.cs b/Assets/VRM10/Runtime/IO/Material/Vrm10MToonMaterialImporter.cs index c0a5420a1..83d4fa9f6 100644 --- a/Assets/VRM10/Runtime/IO/Material/Vrm10MToonMaterialImporter.cs +++ b/Assets/VRM10/Runtime/IO/Material/Vrm10MToonMaterialImporter.cs @@ -224,7 +224,9 @@ namespace UniVRM10 var uvAnimSpeedRotation = mToon?.UvAnimationRotationSpeedFactor; if (uvAnimSpeedRotation.HasValue) { - yield return (MToon10Prop.UvAnimationRotationSpeedFactor.ToUnityShaderLabName(), uvAnimSpeedRotation.Value); + // Speed unit Conversion + const float radianPerSecToRotationPerSec = 1f / (Mathf.PI * 2f); + yield return (MToon10Prop.UvAnimationRotationSpeedFactor.ToUnityShaderLabName(), uvAnimSpeedRotation.Value * radianPerSecToRotationPerSec); } // UI