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 migration behaviour of matcap. #1824

Merged
merged 1 commit into from
Sep 26, 2022
Merged
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
14 changes: 11 additions & 3 deletions Assets/VRM10/Runtime/Migration/Materials/MigrationMToonMaterial.cs
Original file line number Diff line number Diff line change
Expand Up @@ -254,12 +254,17 @@ public static void Migrate(glTF gltf, JsonNode vrm0)
// Rim Lighting
if (mtoon.TextureIndexMap.SphereAdd.HasValue)
{
// Matcap behaviour will change in VRM 1.0.
// NOTE: MatCap behaviour will change in VRM 1.0.
// Texture transform is not required.
dst.MatcapTexture = new TextureInfo
{
Index = mtoon.TextureIndexMap.SphereAdd.Value
};
// Texture transform is not required.
dst.MatcapFactor = new [] { 1f, 1f, 1f };
}
else
{
dst.MatcapFactor = new[] { 0f, 0f, 0f };
}
dst.ParametricRimColorFactor = mtoon.Definition.Rim.RimColor.ToFloat3(ColorSpace.sRGB, ColorSpace.Linear);
dst.ParametricRimFresnelPowerFactor = mtoon.Definition.Rim.RimFresnelPowerValue;
Expand All @@ -279,7 +284,10 @@ public static void Migrate(glTF gltf, JsonNode vrm0)
);
}
}
dst.RimLightingMixFactor = mtoon.Definition.Rim.RimLightingMixValue;
// NOTE: DESTRUCTIVE MIGRATION
// Rim Lighting behaviour will be merged with MatCap in VRM 1.0.
// So, RimLightingMixFactor set to 1.0, because it is safe appearance.
dst.RimLightingMixFactor = 1.0f;

// Outline
const float centimeterToMeter = 0.01f;
Expand Down