浏览代码

Heightmaps are now parametrized with Min/Max values instead of amplitude.

/main
Julien Ignace 7 年前
当前提交
9ddbd02b
共有 5 个文件被更改,包括 46 次插入14 次删除
  1. 18
      ScriptableRenderPipeline/HDRenderPipeline/Material/LayeredLit/LayeredLit.shader
  2. 18
      ScriptableRenderPipeline/HDRenderPipeline/Material/LayeredLit/LayeredLitTessellation.shader
  3. 16
      ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Editor/LitUI.cs
  4. 4
      ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.shader
  5. 4
      ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitTessellation.shader

18
ScriptableRenderPipeline/HDRenderPipeline/Material/LayeredLit/LayeredLit.shader


_HeightMap2("HeightMap2", 2D) = "black" {}
_HeightMap3("HeightMap3", 2D) = "black" {}
_HeightAmplitude0("Height Scale0", Float) = 1
_HeightAmplitude1("Height Scale1", Float) = 1
_HeightAmplitude2("Height Scale2", Float) = 1
_HeightAmplitude3("Height Scale3", Float) = 1
[HideInInspector] _HeightAmplitude0("Height Scale0", Float) = 1
[HideInInspector] _HeightAmplitude1("Height Scale1", Float) = 1
[HideInInspector] _HeightAmplitude2("Height Scale2", Float) = 1
[HideInInspector] _HeightAmplitude3("Height Scale3", Float) = 1
_HeightMin0("Height Min0", Float) = -1
_HeightMin1("Height Min1", Float) = -1
_HeightMin2("Height Min2", Float) = -1
_HeightMin3("Height Min3", Float) = -1
_HeightMax0("Height Max0", Float) = 1
_HeightMax1("Height Max1", Float) = 1
_HeightMax2("Height Max2", Float) = 1
_HeightMax3("Height Max3", Float) = 1
_DetailMap0("DetailMap0", 2D) = "black" {}
_DetailMap1("DetailMap1", 2D) = "black" {}

18
ScriptableRenderPipeline/HDRenderPipeline/Material/LayeredLit/LayeredLitTessellation.shader


_HeightMap2("HeightMap2", 2D) = "black" {}
_HeightMap3("HeightMap3", 2D) = "black" {}
_HeightAmplitude0("Height Scale0", Float) = 1
_HeightAmplitude1("Height Scale1", Float) = 1
_HeightAmplitude2("Height Scale2", Float) = 1
_HeightAmplitude3("Height Scale3", Float) = 1
[HideInInspector] _HeightAmplitude0("Height Scale0", Float) = 1
[HideInInspector] _HeightAmplitude1("Height Scale1", Float) = 1
[HideInInspector] _HeightAmplitude2("Height Scale2", Float) = 1
[HideInInspector] _HeightAmplitude3("Height Scale3", Float) = 1
_HeightMin0("Height Min0", Float) = -1
_HeightMin1("Height Min1", Float) = -1
_HeightMin2("Height Min2", Float) = -1
_HeightMin3("Height Min3", Float) = -1
_HeightMax0("Height Max0", Float) = 1
_HeightMax1("Height Max1", Float) = 1
_HeightMax2("Height Max2", Float) = 1
_HeightMax3("Height Max3", Float) = 1
_DetailMap0("DetailMap0", 2D) = "black" {}
_DetailMap1("DetailMap1", 2D) = "black" {}

16
ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Editor/LitUI.cs


public static GUIContent normalMapOSText = new GUIContent("Normal Map OS", "Normal Map (BC7/DXT1/RGB)");
public static GUIContent specularOcclusionMapText = new GUIContent("Specular Occlusion Map (RGBA)", "Specular Occlusion Map");
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 (distance between minimum and maximum value in the texture).");
public static GUIContent heightMapText = new GUIContent("Height Map (R)", "Height Map.\nFor floating point textures, min, max and base value should be 0, 1 and 0.");
public static GUIContent heightMapMinText = new GUIContent("Height Min", "Minimum value in the heightmap (in world units)");
public static GUIContent heightMapMaxText = new GUIContent("Height Max", "Maximum value in the heightmap (in world units)");
public static GUIContent tangentMapText = new GUIContent("Tangent Map", "Tangent Map (BC7/BC5/DXT5(nm))");
public static GUIContent tangentMapOSText = new GUIContent("Tangent Map OS", "Tangent Map (BC7/DXT1/RGB)");

protected const string kHeightAmplitude = "_HeightAmplitude";
protected MaterialProperty[] heightCenter = new MaterialProperty[kMaxLayerCount];
protected const string kHeightCenter = "_HeightCenter";
protected MaterialProperty[] heightMin = new MaterialProperty[kMaxLayerCount];
protected const string kHeightMin = "_HeightMin";
protected MaterialProperty[] heightMax = new MaterialProperty[kMaxLayerCount];
protected const string kHeightMax = "_HeightMax";
protected MaterialProperty[] UVDetail = new MaterialProperty[kMaxLayerCount];
protected const string kUVDetail = "_UVDetail";

normalMapSpace[i] = FindProperty(string.Format("{0}{1}", kNormalMapSpace, m_PropertySuffixes[i]), props);
heightMap[i] = FindProperty(string.Format("{0}{1}", kHeightMap, m_PropertySuffixes[i]), props);
heightAmplitude[i] = FindProperty(string.Format("{0}{1}", kHeightAmplitude, m_PropertySuffixes[i]), props);
heightMin[i] = FindProperty(string.Format("{0}{1}", kHeightMin, m_PropertySuffixes[i]), props);
heightMax[i] = FindProperty(string.Format("{0}{1}", kHeightMax, m_PropertySuffixes[i]), props);
heightCenter[i] = FindProperty(string.Format("{0}{1}", kHeightCenter, m_PropertySuffixes[i]), props);
// Details

if (!heightMap[layerIndex].hasMixedValue && heightMap[layerIndex].textureValue != null)
{
EditorGUI.indentLevel++;
m_MaterialEditor.ShaderProperty(heightAmplitude[layerIndex], Styles.heightMapAmplitudeText);
heightAmplitude[layerIndex].floatValue = Math.Max(0.0f, heightAmplitude[layerIndex].floatValue); // Must be positive
m_MaterialEditor.ShaderProperty(heightMin[layerIndex], Styles.heightMapMinText);
m_MaterialEditor.ShaderProperty(heightMax[layerIndex], Styles.heightMapMaxText);
heightAmplitude[layerIndex].floatValue = heightMax[layerIndex].floatValue - heightMin[layerIndex].floatValue;
m_MaterialEditor.ShaderProperty(heightCenter[layerIndex], Styles.heightMapCenterText);
EditorGUI.showMixedValue = false;
EditorGUI.indentLevel--;

4
ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.shader


_NormalScale("_NormalScale", Range(0.0, 2.0)) = 1
_HeightMap("HeightMap", 2D) = "black" {}
_HeightAmplitude("Height Amplitude", Float) = 0.01 // In world units
[HideInInspector] _HeightAmplitude("Height Amplitude", Float) = 0.01 // In world units. This will be computed in the UI.
_HeightMin("Heightmap Min", Float) = -1
_HeightMax("Heightmap Max", Float) = 1
_HeightCenter("Height Center", Range(0.0, 1.0)) = 0.5 // In texture space
_DetailMap("DetailMap", 2D) = "black" {}

4
ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitTessellation.shader


_NormalScale("_NormalScale", Range(0.0, 2.0)) = 1
_HeightMap("HeightMap", 2D) = "black" {}
_HeightAmplitude("Height Amplitude", Float) = 0.01 // In world units
[HideInInspector] _HeightAmplitude("Height Amplitude", Float) = 0.01 // In world units
_HeightMin("Heightmap Min", Float) = -1
_HeightMax("Heightmap Max", Float) = 1
_DetailMap("DetailMap", 2D) = "black" {}
_DetailMask("DetailMask", 2D) = "white" {}

正在加载...
取消
保存