浏览代码

inter commit

/main
Paul Melamed 7 年前
当前提交
96a4d824
共有 2 个文件被更改,包括 34 次插入46 次删除
  1. 73
      com.unity.render-pipelines.high-definition/HDRP/Editor/Material/Decal/DecalUI.cs
  2. 7
      com.unity.render-pipelines.high-definition/HDRP/Material/Decal/Decal.shader

73
com.unity.render-pipelines.high-definition/HDRP/Editor/Material/Decal/DecalUI.cs


public static GUIContent AlbedoModeText = new GUIContent("Albedo contribution", "Base color + Blend, Blend only");
}
enum NormalPerPixelBlendSource
enum BlendSource
protected string[] normalPerPixelBlendSourceNames = Enum.GetNames(typeof(NormalPerPixelBlendSource));
protected string[] blendSourceNames = Enum.GetNames(typeof(BlendSource));
enum MaskPerPixelBlendSource
enum BlendMode
Zero,
AlbedoMapAlpha,
MaskMapBlue
Metal_AO_Smoothness,
Metal_Smoothness,
Metal,
AO,
Smoothness
protected string[] maskPerPixelBlendSourceNames = Enum.GetNames(typeof(MaskPerPixelBlendSource));
protected string[] blendModeNames = Enum.GetNames(typeof(BlendMode));
protected MaterialProperty baseColorMap = new MaterialProperty();
protected const string kBaseColorMap = "_BaseColorMap";

protected MaterialProperty albedoMode = new MaterialProperty();
protected const string kAlbedoMode = "_AlbedoMode";
protected MaterialProperty normalPerPixelBlend = new MaterialProperty();
protected const string kNormalPerPixelBlend = "_NormalPerPixelBlend";
protected MaterialProperty normalBlendSrc = new MaterialProperty();
protected const string kNormalBlendSrc = "_NormalBlendSrc";
protected MaterialProperty metalnessPerPixelBlend = new MaterialProperty();
protected const string kMetalnessPerPixelBlend = "_MetalnessPerPixelBlend";
protected MaterialProperty maskBlendSrc = new MaterialProperty();
protected const string kMaskBlendSrc = "_MaskBlendSrc";
protected MaterialProperty AOPerPixelBlend = new MaterialProperty();
protected const string kAOPerPixelBlend = "_AOPerPixelBlend";
protected MaterialProperty smoothnessPerPixelBlend = new MaterialProperty();
protected const string kSmoothnessPerPixelBlend = "_SmoothnessPerPixelBlend";
protected MaterialProperty maskBlendMode = new MaterialProperty();
protected const string kMaskBlendMode = "_MaskBlendMode";
protected MaterialEditor m_MaterialEditor;
// This is call by the inspector

maskMap = FindProperty(kMaskMap, props);
decalBlend = FindProperty(kDecalBlend, props);
albedoMode = FindProperty(kAlbedoMode, props);
normalPerPixelBlend = FindProperty(kNormalPerPixelBlend, props);
metalnessPerPixelBlend = FindProperty(kMetalnessPerPixelBlend, props);
AOPerPixelBlend = FindProperty(kAOPerPixelBlend, props);
smoothnessPerPixelBlend = FindProperty(kSmoothnessPerPixelBlend, props);
normalBlendSrc = FindProperty(kNormalBlendSrc, props);
maskBlendSrc = FindProperty(kMaskBlendSrc, props);
maskBlendMode = FindProperty(kMaskBlendMode, props);
// always instanced
SerializedProperty instancing = m_MaterialEditor.serializedObject.FindProperty("m_EnableInstancingVariants");
instancing.boolValue = true;

{
// Use default labelWidth
EditorGUIUtility.labelWidth = 0f;
float normalPerPixelBlendValue = normalPerPixelBlend.floatValue;
float metalnessPerPixelBlendValue = metalnessPerPixelBlend.floatValue;
float AOPerPixelBlendValue = AOPerPixelBlend.floatValue;
float smoothnessPerPixelBlendValue = smoothnessPerPixelBlend.floatValue;
float normalBlendSrcValue = normalBlendSrc.floatValue;
float maskBlendSrcValue = maskBlendSrc.floatValue;
float maskBlendModeValue = maskBlendMode.floatValue;
EditorGUI.showMixedValue = normalPerPixelBlend.hasMixedValue;
// Detect any changes to the material
EditorGUI.BeginChangeCheck();
{

m_MaterialEditor.TexturePropertySingleLine(Styles.baseColorText2, baseColorMap, baseColor);
}
m_MaterialEditor.TexturePropertySingleLine(Styles.normalMapText, normalMap);
normalPerPixelBlendValue = EditorGUILayout.Popup( "Normal Per Pixel Blend", (int)normalPerPixelBlendValue, normalPerPixelBlendSourceNames);
normalBlendSrcValue = EditorGUILayout.Popup( "Normal Per Pixel Blend", (int)normalBlendSrcValue, blendSourceNames);
metalnessPerPixelBlendValue = EditorGUILayout.Popup( "Metalness Per Pixel Blend", (int)metalnessPerPixelBlendValue, maskPerPixelBlendSourceNames);
smoothnessPerPixelBlendValue = EditorGUILayout.Popup( "Smoothness Per Pixel Blend", (int)smoothnessPerPixelBlendValue, maskPerPixelBlendSourceNames);
EditorGUILayout.Space();
AOPerPixelBlendValue = EditorGUILayout.Popup( "AO Per Pixel Blend", (int)AOPerPixelBlendValue, maskPerPixelBlendSourceNames);
EditorGUILayout.Space();
maskBlendSrcValue = EditorGUILayout.Popup( "Mask blend source", (int)maskBlendSrcValue, blendSourceNames);
maskBlendModeValue = EditorGUILayout.Popup( "Mask blend mode", (int)maskBlendModeValue, blendModeNames);
m_MaterialEditor.ShaderProperty(decalBlend, Styles.decalBlendText);
EditorGUI.indentLevel--;
}

m_MaterialEditor.RegisterPropertyChangeUndo( "Normal Per Pixel Blend");
normalPerPixelBlend.floatValue = normalPerPixelBlendValue;
m_MaterialEditor.RegisterPropertyChangeUndo( "Metalness Per Pixel Blend");
metalnessPerPixelBlend.floatValue = metalnessPerPixelBlendValue;
m_MaterialEditor.RegisterPropertyChangeUndo( "AO Per Pixel Blend");
AOPerPixelBlend.floatValue = AOPerPixelBlendValue;
m_MaterialEditor.RegisterPropertyChangeUndo( "Smoothness Per Pixel Blend");
smoothnessPerPixelBlend.floatValue = smoothnessPerPixelBlendValue;
normalBlendSrc.floatValue = normalBlendSrcValue;
maskBlendSrc.floatValue = maskBlendSrcValue;
maskBlendMode.floatValue = maskBlendModeValue;
EditorGUI.showMixedValue = false;
}
public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] props)

7
com.unity.render-pipelines.high-definition/HDRP/Material/Decal/Decal.shader


_MaskMap("MaskMap", 2D) = "white" {}
_DecalBlend("_DecalBlend", Range(0.0, 1.0)) = 0.5
[ToggleUI] _AlbedoMode("_AlbedoMode", Range(0.0, 1.0)) = 1.0
[HideInInspector] _NormalPerPixelBlend("_NormalPerPixelBlend", Float) = 0.0
[HideInInspector] _MetalnessPerPixelBlend("_MetalnessPerPixelBlend", Float) = 1.0
[HideInInspector] _AOPerPixelBlend("_AOPerPixelBlend", Float) = 1.0
[HideInInspector] _SmoothnessPerPixelBlend("_SmoothnessPerPixelBlend", Float) = 1.0
[HideInInspector] _NormalBlendSrc("_NormalBlendSrc", Float) = 0.0
[HideInInspector] _MaskBlendSrc("_MaskBlendSrc", Float) = 1.0
[HideInInspector] _MaskBlendMode("_MaskBlendMode", Float) = 0.0
}
HLSLINCLUDE

正在加载...
取消
保存