浏览代码

first draft

/use-roughness
sebastienlagarde 7 年前
当前提交
172e38d1
共有 5 个文件被更改,包括 33 次插入4 次删除
  1. 25
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Material/Lit/LitUI.cs
  2. 5
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/LayeredLit/LayeredLit.shader
  3. 5
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/LayeredLit/LayeredLitTessellation.shader
  4. 1
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/Lit.shader
  5. 1
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/LitTessellation.shader

25
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Material/Lit/LitUI.cs


public static GUIContent metallicText = new GUIContent("Metallic", "Metallic scale factor");
public static GUIContent smoothnessText = new GUIContent("Smoothness", "Smoothness scale factor");
public static GUIContent smoothnessRemappingText = new GUIContent("Smoothness Remapping", "Smoothness remapping");
public static GUIContent useRoughnessText = new GUIContent("Use Roughness map", "Enabling this will invert a Roughness map to be used in a Smoothness slot");
public static GUIContent aoRemappingText = new GUIContent("AmbientOcclusion Remapping", "AmbientOcclusion remapping");
public static GUIContent maskMapSText = new GUIContent("Mask Map - M(R), AO(G), D(B), S(A)", "Mask map");
public static GUIContent maskMapSpecularText = new GUIContent("Mask Map - AO(G), D(B), S(A)", "Mask map");

protected const string kSmoothnessRemapMin = "_SmoothnessRemapMin";
protected MaterialProperty[] smoothnessRemapMax = new MaterialProperty[kMaxLayerCount];
protected const string kSmoothnessRemapMax = "_SmoothnessRemapMax";
protected MaterialProperty[] useRoughness = new MaterialProperty[kMaxLayerCount];
protected const string kUseRoughness = "_UseRoughness";
protected MaterialProperty[] aoRemapMin = new MaterialProperty[kMaxLayerCount];
protected const string kAORemapMin = "_AORemapMin";
protected MaterialProperty[] aoRemapMax = new MaterialProperty[kMaxLayerCount];

smoothness[i] = FindProperty(string.Format("{0}{1}", kSmoothness, m_PropertySuffixes[i]), props);
smoothnessRemapMin[i] = FindProperty(string.Format("{0}{1}", kSmoothnessRemapMin, m_PropertySuffixes[i]), props);
smoothnessRemapMax[i] = FindProperty(string.Format("{0}{1}", kSmoothnessRemapMax, m_PropertySuffixes[i]), props);
useRoughness[i] = FindProperty(string.Format("{0}{1}", kUseRoughness, m_PropertySuffixes[i]), props);
aoRemapMin[i] = FindProperty(string.Format("{0}{1}", kAORemapMin, m_PropertySuffixes[i]), props);
aoRemapMax[i] = FindProperty(string.Format("{0}{1}", kAORemapMax, m_PropertySuffixes[i]), props);
maskMap[i] = FindProperty(string.Format("{0}{1}", kMaskMap, m_PropertySuffixes[i]), props);

if(maskMap[layerIndex].textureValue == null)
{
m_MaterialEditor.ShaderProperty(smoothness[layerIndex], Styles.smoothnessText);
m_MaterialEditor.TexturePropertySingleLine(((BaseLitGUI.MaterialId)materialID.floatValue == BaseLitGUI.MaterialId.LitSpecular) ? Styles.maskMapSpecularText : Styles.maskMapSText, maskMap[layerIndex]);
m_MaterialEditor.TexturePropertySingleLine(((BaseLitGUI.MaterialId)materialID.floatValue == BaseLitGUI.MaterialId.LitSpecular) ? Styles.maskMapSpecularText : Styles.maskMapSText, maskMap[layerIndex]);
EditorGUI.indentLevel++;
m_MaterialEditor.ShaderProperty(useRoughness[layerIndex], Styles.useRoughnessText);
smoothnessRemapMin[layerIndex].floatValue = remapMin;
smoothnessRemapMax[layerIndex].floatValue = remapMax;
// If we use roughness map instead of smoothness map, just invert the range remapping
if (useRoughness[layerIndex].floatValue > 0.0)
{
smoothnessRemapMin[layerIndex].floatValue = remapMax;
smoothnessRemapMax[layerIndex].floatValue = remapMin;
}
else
{
smoothnessRemapMin[layerIndex].floatValue = remapMin;
smoothnessRemapMax[layerIndex].floatValue = remapMax;
}
}
float aoMin = aoRemapMin[layerIndex].floatValue;

aoRemapMin[layerIndex].floatValue = aoMin;
aoRemapMax[layerIndex].floatValue = aoMax;
}
EditorGUI.indentLevel--;
m_MaterialEditor.TexturePropertySingleLine(((BaseLitGUI.MaterialId)materialID.floatValue == BaseLitGUI.MaterialId.LitSpecular) ? Styles.maskMapSpecularText : Styles.maskMapSText, maskMap[layerIndex]);
m_MaterialEditor.ShaderProperty(normalMapSpace[layerIndex], Styles.normalMapSpaceText);

5
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/LayeredLit/LayeredLit.shader


_SmoothnessRemapMax2("SmoothnessRemapMax2", Range(0.0, 1.0)) = 1.0
_SmoothnessRemapMax3("SmoothnessRemapMax3", Range(0.0, 1.0)) = 1.0
[ToggleUI] _UseRoughness0("Use Roughness", Float) = 0.0
[ToggleUI] _UseRoughness1("Use Roughness", Float) = 0.0
[ToggleUI] _UseRoughness2("Use Roughness", Float) = 0.0
[ToggleUI] _UseRoughness3("Use Roughness", Float) = 0.0
_AORemapMin0("AORemapMin0", Range(0.0, 1.0)) = 0.0
_AORemapMin1("AORemapMin1", Range(0.0, 1.0)) = 0.0
_AORemapMin2("AORemapMin2", Range(0.0, 1.0)) = 0.0

5
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/LayeredLit/LayeredLitTessellation.shader


_SmoothnessRemapMax2("SmoothnessRemapMax2", Range(0.0, 1.0)) = 1.0
_SmoothnessRemapMax3("SmoothnessRemapMax3", Range(0.0, 1.0)) = 1.0
[ToggleUI] _UseRoughness0("Use Roughness", Float) = 0.0
[ToggleUI] _UseRoughness1("Use Roughness", Float) = 0.0
[ToggleUI] _UseRoughness2("Use Roughness", Float) = 0.0
[ToggleUI] _UseRoughness3("Use Roughness", Float) = 0.0
_AORemapMin0("AORemapMin0", Range(0.0, 1.0)) = 0.0
_AORemapMin1("AORemapMin1", Range(0.0, 1.0)) = 0.0
_AORemapMin2("AORemapMin2", Range(0.0, 1.0)) = 0.0

1
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/Lit.shader


_MaskMap("MaskMap", 2D) = "white" {}
_SmoothnessRemapMin("SmoothnessRemapMin", Float) = 0.0
_SmoothnessRemapMax("SmoothnessRemapMax", Float) = 1.0
[ToggleUI] _UseRoughness("Use Roughness", Float) = 0.0
_AORemapMin("AORemapMin", Float) = 0.0
_AORemapMax("AORemapMax", Float) = 1.0

1
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/LitTessellation.shader


_MaskMap("MaskMap", 2D) = "white" {}
_SmoothnessRemapMin("SmoothnessRemapMin", Float) = 0.0
_SmoothnessRemapMax("SmoothnessRemapMax", Float) = 1.0
[ToggleUI] _UseRoughness("Use Roughness", Float) = 0.0
_AORemapMin("AORemapMin", Float) = 0.0
_AORemapMax("AORemapMax", Float) = 1.0

正在加载...
取消
保存