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

Fix uv rotation coords of vrm-1.0 #1826

Merged
merged 2 commits into from
Sep 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,11 @@ public static bool TryExportMaterialAsMToon(Material src, ITextureExporter textu
const float invertY = -1f;
mtoon.UvAnimationScrollYSpeedFactor = context.UvAnimationScrollYSpeedFactor * invertY;
}
mtoon.UvAnimationRotationSpeedFactor = context.UvAnimationRotationSpeedFactor;
// Speed unit Conversion
const float rotationPerSecToRadianPerSec = Mathf.PI * 2f;
// Coords conversion
const float unityToGltfCoordsConversion = -1f;
mtoon.UvAnimationRotationSpeedFactor = context.UvAnimationRotationSpeedFactor * rotationPerSecToRadianPerSec * unityToGltfCoordsConversion;

// Texture Transforms
var scale = context.TextureScale;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,11 @@ public static bool TryCreateParam(GltfData data, int i, out MaterialDescriptor m
var uvAnimSpeedRotation = mToon?.UvAnimationRotationSpeedFactor;
if (uvAnimSpeedRotation.HasValue)
{
yield return (MToon10Prop.UvAnimationRotationSpeedFactor.ToUnityShaderLabName(), uvAnimSpeedRotation.Value);
// Speed unit Conversion
const float radianPerSecToRotationPerSec = 1f / (Mathf.PI * 2f);
// Coords conversion
const float gltfToUnityCoordsConversion = -1f;
yield return (MToon10Prop.UvAnimationRotationSpeedFactor.ToUnityShaderLabName(), uvAnimSpeedRotation.Value * radianPerSecToRotationPerSec * gltfToUnityCoordsConversion);
}

// UI
Expand Down