浏览代码

Changed the way heightmaps scale and bias are displayed in the GUI. It's now H = (h - center) * amplitude.

/main
Julien Ignace 8 年前
当前提交
0d4ab3d2
共有 3 个文件被更改,包括 28 次插入2 次删除
  1. 2
      Assets/ScriptableRenderLoop/HDRenderPipeline/Material/Lit/Editor/BaseLitUI.cs
  2. 23
      Assets/ScriptableRenderLoop/HDRenderPipeline/Material/Lit/Editor/LitUI.cs
  3. 5
      Assets/ScriptableRenderLoop/HDRenderPipeline/Material/Lit/Lit.shader

2
Assets/ScriptableRenderLoop/HDRenderPipeline/Material/Lit/Editor/BaseLitUI.cs


public static GUIContent normalMapText = new GUIContent("Normal Map", "Normal Map (DXT5) - Need to implement BC5");
public static GUIContent heightMapText = new GUIContent("Height Map (R)", "Height Map");
public static GUIContent heightMapAmplitudeText = new GUIContent("Height Map Amplitude", "Height Map amplitude in world units.");
public static GUIContent heightMapCenterText = new GUIContent("Height Map Center", "Center of the heightmap in the texture (between 0 and 1)");
public static GUIContent tangentMapText = new GUIContent("Tangent Map", "Tangent Map (BC5) - DXT5 for test");
public static GUIContent anisotropyText = new GUIContent("Anisotropy", "Anisotropy scale factor");

23
Assets/ScriptableRenderLoop/HDRenderPipeline/Material/Lit/Editor/LitUI.cs


m_MaterialEditor.TexturePropertySingleLine(Styles.normalMapText, normalMap, normalScale);
m_MaterialEditor.TexturePropertySingleLine(Styles.heightMapText, heightMap, heightScale, heightBias);
m_MaterialEditor.TexturePropertySingleLine(Styles.heightMapText, heightMap);
if(!heightMap.hasMixedValue && heightMap.textureValue != null)
{
// Be careful, the scale and bias here is different from the one shader properties
// In the shader values are in world units and the formula is finalHeight = height * scale + bias
// In the GUI it's (height - center) * amplitude
EditorGUI.indentLevel++;
float amplitude = heightScale.floatValue;
float center = -heightBias.floatValue / amplitude;
// Scale = Amplitude so no need for special handling
m_MaterialEditor.ShaderProperty(heightScale, Styles.heightMapAmplitudeText);
EditorGUI.showMixedValue = heightScale.hasMixedValue;
EditorGUI.BeginChangeCheck();
float newCenter = EditorGUILayout.FloatField(Styles.heightMapCenterText, center);
if(EditorGUI.EndChangeCheck())
{
heightBias.floatValue = -newCenter * amplitude;
}
EditorGUI.showMixedValue = false;
EditorGUI.indentLevel--;
}
m_MaterialEditor.TexturePropertySingleLine(Styles.tangentMapText, tangentMap);

5
Assets/ScriptableRenderLoop/HDRenderPipeline/Material/Lit/Lit.shader


_NormalMap("NormalMap", 2D) = "bump" {}
_NormalScale("_NormalScale", Range(0.0, 2.0)) = 1
// Be careful, the scale and bias here is different from the one shown in the GUI
// Here both value are in world units and the formula is finalHeight = height * scale + bias
// In the GUI it's (height - center) * amplitude
_HeightBias("Height Bias", Float) = 0
_HeightBias("Height Bias", Float) = -0.005
_TangentMap("TangentMap", 2D) = "bump" {}
_Anisotropy("Anisotropy", Range(0.0, 1.0)) = 0

正在加载...
取消
保存