Skip to content

Commit

Permalink
Revert ""glossiness" and "roughness" were used confusingly with the s…
Browse files Browse the repository at this point in the history
…ame shader property; for now we're converting everything to "glossiness" to avoid larger code changes"

This reverts commit 34730cd.
  • Loading branch information
hybridherbst committed Mar 22, 2021
1 parent 51a43b1 commit d5cc257
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions UnityGLTF/Assets/UnityGLTF/Editor/Scripts/PbrShaderGUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ private static class Styles
public static GUIContent metallicMapText = new GUIContent("Metal Rough", "Metallic (B) and Roughness (G)");
public static GUIContent metallicText = new GUIContent("Metallic", "Metallic value");
public static GUIContent metallicScaleText = new GUIContent("Metallic", "Metallic scale factor");
public static GUIContent roughnessText = new GUIContent("Glossiness (1 - Roughness)", "Roughness value");
public static GUIContent roughnessText = new GUIContent("Roughness", "Roughness value");

public static GUIContent roughnessScaleText = new GUIContent("Glossiness (1 - Roughness)", "Roughness scale factor");
public static GUIContent roughnessScaleText = new GUIContent("Roughness", "Roughness scale factor");
public static GUIContent glossinessText = new GUIContent("Glossiness", "Glossiness value");
public static GUIContent glossinessScaleText = new GUIContent("Glossiness", "Glossiness scale factor");
public static GUIContent normalMapText = new GUIContent("Normal Map", "Normal Map");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,11 @@ public virtual double MetallicFactor
set { _material.SetFloat("_Metallic", (float)value); }
}

// not supported by the Standard shader
public virtual double RoughnessFactor
{
get { return 1 - _material.GetFloat("_Glossiness"); }
set { _material.SetFloat("_Glossiness", 1 - (float)value); }
get { return 0.5; }
set { return; }
}

public override IUniformMap Clone()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ public override int MetallicRoughnessXTexCoord

public override double RoughnessFactor
{
get { return 1 - _material.GetFloat("_Glossiness"); }
set { _material.SetFloat("_Glossiness", 1 - (float)value); }
get { return _material.GetFloat("_Glossiness"); }
set { _material.SetFloat("_Glossiness", (float)value); }
}

public override IUniformMap Clone()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Shader "GLTF/PbrMetallicRoughness"

_Cutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5

_Glossiness("Glossiness Factor (1 - Roughness)", Range(0.0, 1.0)) = 1.0
_Glossiness("Roughness Factor", Range(0.0, 1.0)) = 1.0

_Metallic("Metallic Factor", Range(0.0, 1.0)) = 0.0
_MetallicGlossMap("Metal Rough Texture", 2D) = "white" {}
Expand Down

0 comments on commit d5cc257

Please sign in to comment.