浏览代码

HDRenderLoop: Correction Metallic name

/main
sebastienlagarde 8 年前
当前提交
f7bb55e1
共有 3 个文件被更改,包括 13 次插入13 次删除
  1. 10
      Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Lit.cs
  2. 2
      Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Lit.shader
  3. 14
      Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/TemplateLit.hlsl

10
Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Lit.cs


public static GUIContent baseColorText = new GUIContent("Base Color", "Albedo (RGB) and Smoothness (A)");
public static GUIContent baseColorSmoothnessText = new GUIContent("Base Color + Smoothness", "Albedo (RGB) and Smoothness (A)");
public static GUIContent mettalicText = new GUIContent("Mettalic", "Mettalic scale factor");
public static GUIContent metalicText = new GUIContent("Metalic", "Metalic scale factor");
public static GUIContent smoothnessText = new GUIContent("Smoothness", "Smoothness scale factor");
public static GUIContent maskMapESText = new GUIContent("Mask Map - M(R), AO(G), E(B), S(A)", "Mask map");
public static GUIContent maskMapEText = new GUIContent("Mask Map - M(R), AO(G), E(B)", "Mask map");

MaterialProperty baseColor = null;
MaterialProperty baseColorMap = null;
MaterialProperty mettalic = null;
MaterialProperty metalic = null;
MaterialProperty smoothness = null;
MaterialProperty maskMap = null;
MaterialProperty specularOcclusionMap = null;

baseColor = FindProperty("_BaseColor", props);
baseColorMap = FindProperty("_BaseColorMap", props);
mettalic = FindProperty("_Mettalic", props);
metalic = FindProperty("_Metalic", props);
smoothness = FindProperty("_Smoothness", props);
maskMap = FindProperty("_MaskMap", props);
specularOcclusionMap = FindProperty("_SpecularOcclusionMap", props);

GUILayout.Label(Styles.InputsText, EditorStyles.boldLabel);
m_MaterialEditor.TexturePropertySingleLine(isAlbedoAlpha ? Styles.baseColorSmoothnessText : Styles.baseColorText, baseColorMap, baseColor);
m_MaterialEditor.ShaderProperty(mettalic, Styles.mettalicText);
m_MaterialEditor.ShaderProperty(metalic, Styles.metalicText);
m_MaterialEditor.ShaderProperty(smoothness, Styles.smoothnessText);
if (isAlbedoAlpha && useEmissiveMask)

2
Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/Lit.shader


_BaseColor("BaseColor", Color) = (1,1,1,1)
_BaseColorMap("BaseColorMap", 2D) = "white" {}
_Mettalic("Mettalic", Range(0.0, 1.0)) = 0
_Metalic("_Metalic", Range(0.0, 1.0)) = 0
_Smoothness("Smoothness", Range(0.0, 1.0)) = 0.5
_MaskMap("MaskMap", 2D) = "white" {}

14
Assets/ScriptableRenderLoop/HDRenderLoop/Shaders/TemplateLit.hlsl


float4 _BaseColor;
sampler2D _BaseColorMap;
float _Mettalic;
float _Metalic;
float _Smoothness;
sampler2D _MaskMap;
sampler2D _SpecularOcclusionMap;

builtinData.opacity = alpha;
// MaskMap is Mettalic, Ambient Occlusion, (Optional) - emissive Mask, Optional - Smoothness (in alpha)
// MaskMap is Metalic, Ambient Occlusion, (Optional) - emissive Mask, Optional - Smoothness (in alpha)
float mettalic = tex2D(_MaskMap, input.texCoord0).r;
float metalic = tex2D(_MaskMap, input.texCoord0).r;
float mettalic = 1.0;
float metalic = 1.0;
mettalic *= _Mettalic;
metalic *= _Metalic;
surfaceData.diffuseColor = baseColor * (1.0 - mettalic);
surfaceData.diffuseColor = baseColor * (1.0 - metalic);
surfaceData.specularColor = lerp(float3(f0_dieletric, f0_dieletric, f0_dieletric), baseColor, mettalic);
surfaceData.specularColor = lerp(float3(f0_dieletric, f0_dieletric, f0_dieletric), baseColor, metalic);
#ifdef _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
surfaceData.perceptualSmoothness = tex2D(_BaseColorMap, input.texCoord0).a;

正在加载...
取消
保存