Skip to content

Commit

Permalink
Merge pull request #185 from hiroj/fix_MetallicSmoothness
Browse files Browse the repository at this point in the history
Fix to restore Smoothness value when setting Metallic map
  • Loading branch information
yutopp authored Feb 7, 2019
2 parents 3aa0ef6 + bfff027 commit 9db72cd
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Assets/VRM/UniGLTF/Scripts/IO/MaterialImporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,15 @@ public virtual Material CreateMaterial(int i, glTFMaterial x)
var prop = "_MetallicGlossMap";
material.SetTexture(prop, texture.ConvertTexture(prop));
}

material.SetFloat("_Metallic", 1.0f);
material.SetFloat("_GlossMapScale", 1.0f - x.pbrMetallicRoughness.roughnessFactor);
}
else
{
material.SetFloat("_Metallic", x.pbrMetallicRoughness.metallicFactor);
material.SetFloat("_Glossiness", 1.0f - x.pbrMetallicRoughness.roughnessFactor);
}

material.SetFloat("_Metallic", x.pbrMetallicRoughness.metallicFactor);
material.SetFloat("_Glossiness", 1.0f - x.pbrMetallicRoughness.roughnessFactor);
}

if (x.normalTexture != null && x.normalTexture.index != -1)
Expand Down

0 comments on commit 9db72cd

Please sign in to comment.