Skip to content

Commit

Permalink
Merge pull request #339 from hiroj/fix_export_colorSpace
Browse files Browse the repository at this point in the history
fix baseColorFactor color space.
  • Loading branch information
ousttrue authored Dec 12, 2019
2 parents 3697dd5 + 04c69a1 commit 9de04a3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Assets/VRM/UniGLTF/Scripts/IO/MaterialExporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ static void Export_Color(Material m, TextureExportManager textureManager, glTFMa
{
if (m.HasProperty("_Color"))
{
material.pbrMetallicRoughness.baseColorFactor = m.color.ToArray();
material.pbrMetallicRoughness.baseColorFactor = m.color.linear.ToArray();
}

if (m.HasProperty("_MainTex"))
Expand Down
4 changes: 2 additions & 2 deletions Assets/VRM/UniGLTF/Scripts/IO/MaterialImporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public virtual Material CreateMaterial(int i, glTFMaterial x)
if (x.pbrMetallicRoughness.baseColorFactor != null && x.pbrMetallicRoughness.baseColorFactor.Length == 4)
{
var color = x.pbrMetallicRoughness.baseColorFactor;
material.color = new Color(color[0], color[1], color[2], color[3]);
material.color = (new Color(color[0], color[1], color[2], color[3])).gamma;
}

//renderMode
Expand Down Expand Up @@ -145,7 +145,7 @@ public virtual Material CreateMaterial(int i, glTFMaterial x)
if (x.pbrMetallicRoughness.baseColorFactor != null && x.pbrMetallicRoughness.baseColorFactor.Length == 4)
{
var color = x.pbrMetallicRoughness.baseColorFactor;
material.color = new Color(color[0], color[1], color[2], color[3]);
material.color = (new Color(color[0], color[1], color[2], color[3])).gamma;
}

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

0 comments on commit 9de04a3

Please sign in to comment.