本文整理汇总了C#中UnityEditor.MaterialEditor.ShaderProperty方法的典型用法代码示例。如果您正苦于以下问题:C# MaterialEditor.ShaderProperty方法的具体用法?C# MaterialEditor.ShaderProperty怎么用?C# MaterialEditor.ShaderProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEditor.MaterialEditor
的用法示例。
在下文中一共展示了MaterialEditor.ShaderProperty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawLayer
void DrawLayer(MaterialEditor editor, int i, MaterialProperty[] props, string[] keyWords, Workflow workflow,
bool hasGloss, bool hasSpec, bool isParallax, bool hasEmis, bool hasDistBlend)
{
EditorGUIUtility.labelWidth = 0f;
var albedoMap = FindProperty ("_Tex" + i, props);
var tint = FindProperty("_Tint" + i, props);
var normalMap = FindProperty ("_Normal" + i, props);
var smoothness = FindProperty("_Glossiness" + i, props);
var glossinessMap = FindProperty("_GlossinessTex" + i, props, false);
var metallic = FindProperty("_Metallic" + i, props, false);
var emissionTex = FindProperty("_Emissive" + i, props);
var emissionMult = FindProperty("_EmissiveMult" + i, props);
var parallax = FindProperty("_Parallax" + i, props);
var texScale = FindProperty("_TexScale" + i, props);
var specMap = FindProperty("_SpecGlossMap" + i, props, false);
var specColor = FindProperty("_SpecColor" + i, props, false);
var distUVScale = FindProperty("_DistUVScale" + i, props, false);
editor.TexturePropertySingleLine(new GUIContent("Albedo/Height"), albedoMap);
editor.ShaderProperty(tint, "Tint");
editor.TexturePropertySingleLine(new GUIContent("Normal"), normalMap);
if (workflow == Workflow.Metallic)
{
editor.TexturePropertySingleLine(new GUIContent("Metal(R)/Smoothness(A)"), glossinessMap);
}
else
{
editor.TexturePropertySingleLine(new GUIContent("Specular(RGB)/Gloss(A)"), specMap);
}
if (workflow == Workflow.Metallic && !hasGloss)
{
editor.ShaderProperty(smoothness, "Smoothness");
editor.ShaderProperty(metallic, "Metallic");
}
else if (workflow == Workflow.Specular && !hasSpec)
{
editor.ShaderProperty(smoothness, "Smoothness");
editor.ShaderProperty(specColor, "Specular Color");
}
editor.TexturePropertySingleLine(new GUIContent("Emission"), emissionTex);
editor.ShaderProperty(emissionMult, "Emissive Multiplier");
editor.ShaderProperty(texScale, "Texture Scale");
if (hasDistBlend)
{
editor.ShaderProperty(distUVScale, "Distance UV Scale");
}
if (isParallax)
{
editor.ShaderProperty(parallax, "Parallax Height");
}
if (i != 1)
{
editor.ShaderProperty(FindProperty("_Contrast"+i, props), "Interpolation Contrast");
}
}
示例2: ShaderPropertiesGUI
bool ShaderPropertiesGUI(MaterialEditor materialEditor)
{
EditorGUI.BeginChangeCheck();
materialEditor.TexturePropertySingleLine(_textCubemap, _cubemap, _tint);
Vector3Property(materialEditor, _euler, "Rotation");
materialEditor.ShaderProperty(_exposure, "Exposure");
materialEditor.ShaderProperty(_saturation, "Saturation");
return EditorGUI.EndChangeCheck();
}
示例3: ShaderPropertiesGUI
bool ShaderPropertiesGUI(MaterialEditor materialEditor)
{
EditorGUI.BeginChangeCheck();
materialEditor.ShaderProperty(_colorMode, "Color Mode");
if (_colorMode.floatValue > 0)
{
var rect = EditorGUILayout.GetControlRect();
rect.x += EditorGUIUtility.labelWidth;
rect.width = (rect.width - EditorGUIUtility.labelWidth) / 2 - 2;
materialEditor.ShaderProperty(rect, _color, "");
rect.x += rect.width + 4;
materialEditor.ShaderProperty(rect, _color2, "");
}
else
{
materialEditor.ShaderProperty(_color, " ");
}
EditorGUILayout.Space();
materialEditor.ShaderProperty(_metallic, "Metallic");
materialEditor.ShaderProperty(_smoothness, "Smoothness");
EditorGUILayout.Space();
materialEditor.TexturePropertySingleLine(_albedoText, _albedoMap, null);
materialEditor.TexturePropertySingleLine(_normalMapText, _normalMap, _normalMap.textureValue ? _normalScale : null);
materialEditor.TexturePropertySingleLine(_occlusionText, _occlusionMap, _occlusionMap.textureValue ? _occlusionStr : null);
materialEditor.TextureScaleOffsetProperty(_albedoMap);
return EditorGUI.EndChangeCheck();
}
示例4: ShaderPropertiesGUI
bool ShaderPropertiesGUI(MaterialEditor materialEditor)
{
EditorGUI.BeginChangeCheck();
materialEditor.TexturePropertySingleLine(_textCubemap, _cubemap, _tint);
Vector3Property(materialEditor, _euler, "Rotation");
materialEditor.ShaderProperty(_exposure, "Exposure");
materialEditor.ShaderProperty(_saturation, "Saturation");
materialEditor.ShaderProperty(_lod, "Specify MIP Level");
if (_lod.hasMixedValue || _lod.floatValue > 0)
{
EditorGUI.indentLevel++;
materialEditor.ShaderProperty(_lodLevel, "Level");
EditorGUI.indentLevel--;
}
return EditorGUI.EndChangeCheck();
}
示例5: ShaderPropertiesGUI
bool ShaderPropertiesGUI(MaterialEditor materialEditor)
{
EditorGUI.BeginChangeCheck();
materialEditor.ShaderProperty(_blendMode, "Blend Mode");
materialEditor.ShaderProperty(_colorMode, "Color Mode");
if (_colorMode.floatValue > 0)
{
var rect = EditorGUILayout.GetControlRect();
rect.x += EditorGUIUtility.labelWidth;
rect.width = (rect.width - EditorGUIUtility.labelWidth) / 2 - 2;
materialEditor.ShaderProperty(rect, _color, "");
rect.x += rect.width + 4;
materialEditor.ShaderProperty(rect, _color2, "");
}
else
{
materialEditor.ShaderProperty(_color, " ");
}
materialEditor.ShaderProperty(_mainTex, "Texture");
return EditorGUI.EndChangeCheck();
}
示例6: ShaderPropertiesGUI
bool ShaderPropertiesGUI(MaterialEditor materialEditor)
{
EditorGUI.BeginChangeCheck();
materialEditor.TexturePropertySingleLine(_albedoText, _albedoMap, _albedoColor);
materialEditor.ShaderProperty(_metallic, "Metallic");
materialEditor.ShaderProperty(_smoothness, "Smoothness");
EditorGUILayout.Space();
materialEditor.TexturePropertySingleLine(_normalMapText, _bumpMap, null);
EditorGUILayout.Space();
materialEditor.TexturePropertySingleLine(_occlusionText, _occlusionMap, _occlusionMap.textureValue ? _occlusionStrength : null);
EditorGUILayout.Space();
materialEditor.ShaderProperty(_mapScale, "Mapping Scale");
return EditorGUI.EndChangeCheck();
}
示例7: ShaderPropertiesGUI
bool ShaderPropertiesGUI(MaterialEditor materialEditor)
{
EditorGUI.BeginChangeCheck();
materialEditor.ShaderProperty(_color, "Color");
materialEditor.ShaderProperty(_metallic, "Metallic");
materialEditor.ShaderProperty(_smoothness, "Smoothness");
EditorGUILayout.Space();
materialEditor.TexturePropertySingleLine(_albedoText, _albedoMap, null);
var scale = _normalMap.textureValue ? _normalScale : null;
materialEditor.TexturePropertySingleLine(_normalMapText, _normalMap, scale);
var str = _occlusionMap.textureValue ? _occlusionStr : null;
materialEditor.TexturePropertySingleLine(_occlusionText, _occlusionMap, str);
if (_albedoMap.textureValue || _normalMap.textureValue || _occlusionMap.textureValue)
materialEditor.ShaderProperty(_mapScale, "Scale");
return EditorGUI.EndChangeCheck();
}
示例8: DoKeyword
protected bool DoKeyword(MaterialEditor _editor, MaterialProperty _prop, string _desc)
{
string _keyword;
if (!m_Keywords.TryGetValue (_prop.name, out _keyword))
return false;
_editor.ShaderProperty(_prop, _desc);
bool _on = _prop.floatValue > 0;
var _mtl = _editor.target as Material;
if (_on)
_mtl.EnableKeyword(_keyword);
else
_mtl.DisableKeyword(_keyword);
return _on;
}
示例9: ShaderPropertiesGUI
bool ShaderPropertiesGUI(MaterialEditor materialEditor)
{
EditorGUI.BeginChangeCheck();
materialEditor.ShaderProperty(_baseColor, "Base Color");
materialEditor.ShaderProperty(_exposure, "Exposure");
EditorGUILayout.Space();
EditorGUILayout.LabelField("Gradient 1");
Vector3Property(materialEditor, _direction1, "Direction");
materialEditor.ShaderProperty(_color1, "Color");
materialEditor.ShaderProperty(_exponent1, "Exponent");
EditorGUILayout.Space();
materialEditor.ShaderProperty(_switch2, "Gradient 2");
if (_switch2.floatValue > 0)
{
Vector3Property(materialEditor, _direction2, "Direction");
materialEditor.ShaderProperty(_color2, "Color");
materialEditor.ShaderProperty(_exponent2, "Exponent");
EditorGUILayout.Space();
}
materialEditor.ShaderProperty(_switch3, "Gradient 3");
if (_switch3.floatValue > 0)
{
Vector3Property(materialEditor, _direction3, "Direction");
materialEditor.ShaderProperty(_color3, "Color");
materialEditor.ShaderProperty(_exponent3, "Exponent");
EditorGUILayout.Space();
}
materialEditor.ShaderProperty(_switch4, "Gradient 4");
if (_switch4.floatValue > 0)
{
Vector3Property(materialEditor, _direction4, "Direction");
materialEditor.ShaderProperty(_color4, "Color");
materialEditor.ShaderProperty(_exponent4, "Exponent");
}
return EditorGUI.EndChangeCheck();
}
示例10: DoGeneral
private void DoGeneral(MaterialEditor _materialEditor)
{
if (!BeginGroup("General"))
return;
_materialEditor.ShaderProperty(m_FadeOut, "Fade Out");
_materialEditor.TextureProperty(m_BayerTex, "Differ Matrix");
_materialEditor.TextureProperty(m_MainTex, "Main Texture (RGBA)");
if (DoKeyword(_materialEditor, m_DimOn, "Use Dim Texture"))
{
_materialEditor.TextureProperty(m_DimTex, "Dim Texture (RGB)");
}
_materialEditor.TextureProperty(m_DiffuseLUTTex, "Diffuse LUT");
_materialEditor.TextureProperty(m_SpecularLUTTex, "Specular LUT");
EndGroup();
}
示例11: DrawLayer
void DrawLayer(MaterialEditor editor, int i, MaterialProperty[] props, string[] keyWords, bool hasGloss, bool isParallax, bool hasEmis)
{
EditorGUIUtility.labelWidth = 0f;
var albedoMap = FindProperty ("_Tex" + i, props);
var normalMap = FindProperty ("_Normal" + i, props);
var smoothness = FindProperty("_Glossiness" + i, props);
var glossinessMap = FindProperty("_GlossinessTex" + i, props);
var metallic = FindProperty("_Metallic" + i, props);
var emissionTex = FindProperty("_Emissive" + i, props);
var emissionMult = FindProperty("_EmissiveMult" + i, props);
var parallax = FindProperty("_Parallax" + i, props);
var texScale = FindProperty("_TexScale" + i, props);
//editor.TexturePropertySingleLine("Albedo (RGB) Height (A)", albedoMap);
editor.TexturePropertySingleLine(new GUIContent("Albedo/Height"), albedoMap);
editor.TexturePropertySingleLine(new GUIContent("Normal"), normalMap);
editor.TexturePropertySingleLine(new GUIContent("Metal(R)/Smoothness(A)"), glossinessMap);
if (!hasGloss)
{
editor.ShaderProperty(smoothness, "Smoothness");
editor.ShaderProperty(metallic, "Metallic");
}
editor.TexturePropertySingleLine(new GUIContent("Emission"), emissionTex);
editor.ShaderProperty(emissionMult, "Emissive Multiplier");
editor.ShaderProperty(texScale, "Texture Scale");
if (isParallax)
{
editor.ShaderProperty(parallax, "Parallax Height");
}
if (i != 1)
{
editor.ShaderProperty(FindProperty("_Contrast"+i, props), "Interpolation Contrast");
}
}
示例12: ImmediateProperty
bool ImmediateProperty(string name, MaterialEditor materialEditor, MaterialProperty[] props)
{
EditorGUI.BeginChangeCheck();
var p = FindProperty(name, props);
if(p.type == MaterialProperty.PropType.Texture)
materialEditor.TexturePropertySingleLine(new GUIContent(p.displayName), p);
else
materialEditor.ShaderProperty(p, p.displayName);
return EditorGUI.EndChangeCheck();
}
示例13: ShaderPropertiesGUI
bool ShaderPropertiesGUI(MaterialEditor materialEditor)
{
EditorGUI.BeginChangeCheck();
EditorGUILayout.LabelField("Front-face properties", EditorStyles.boldLabel);
EditorGUILayout.Space();
// albedo
materialEditor.TexturePropertySingleLine(_albedoText, _mainTex, _color);
// metallic / smoothness
if (_metallicGlossMap.textureValue == null)
materialEditor.TexturePropertyTwoLines(_metallicText, _metallicGlossMap, _metallic, _smoothnessText, _glossiness);
else
materialEditor.TexturePropertySingleLine(_metallicText, _metallicGlossMap);
// normal map
materialEditor.TexturePropertySingleLine(_normalMapText, _bumpMap, _bumpMap.textureValue != null ? _bumpScale : null);
// occlusion
materialEditor.TexturePropertySingleLine(_occlusionText, _occlusionMap, _occlusionMap.textureValue != null ? _occlusionStrength : null);
// emission
bool hadEmissionTexture = _emissionMap.textureValue != null;
materialEditor.TexturePropertyWithHDRColor(_emissionText, _emissionMap, _emissionColor, _colorPickerHDRConfig, false);
// if texture was assigned and color was black set color to white
if (_emissionMap.textureValue != null && !hadEmissionTexture)
if (_emissionColor.colorValue.maxColorComponent <= 0)
_emissionColor.colorValue = Color.white;
EditorGUILayout.Space();
// backface properties
EditorGUILayout.LabelField("Back-face properties", EditorStyles.boldLabel);
EditorGUILayout.Space();
materialEditor.ShaderProperty(_backColor, "Color");
materialEditor.ShaderProperty(_backMetallic, "Matallic");
materialEditor.ShaderProperty(_backGlossiness, "Smoothness");
return EditorGUI.EndChangeCheck();
}
示例14: DoGeneral
private void DoGeneral(MaterialEditor _materialEditor)
{
if (!BeginGroup("General"))
return;
_materialEditor.TextureProperty(m_MainTex, "Main Texture (RGB)");
_materialEditor.TextureProperty(m_BayerTex, "Differ Matrix");
_materialEditor.ShaderProperty(m_FadeOut, "Fade Out");
DoKeyword(_materialEditor, m_TextureFadeOutOn, "Fade Out (Tex Alpha)");
if (DoKeyword(_materialEditor, m_IrradianceOn, "Use Irradiance"))
{
_materialEditor.ShaderProperty(m_IrradianceBoost, "Irradiance Boost");
}
DoKeyword(_materialEditor, m_DarkenBackfacesOn, "Use Darken Backfaces");
if (DoKeyword (_materialEditor, m_DimOn, "Use Dim Texture"))
{
_materialEditor.TextureProperty (m_DimTex, "Dim Texture (RGB)");
}
EndGroup();
}
示例15: DoRim
private void DoRim(MaterialEditor _materialEditor)
{
if (!BeginGroup("Rim"))
return;
if (DoKeyword(_materialEditor, m_RimOn, "Use Rim"))
{
_materialEditor.ShaderProperty(m_RimLUTTex, "Rim LUT (Grayscale)");
_materialEditor.ShaderProperty(m_RimIntensity, "Rim Intensity");
}
EndGroup();
}