浏览代码

Add EnableHeightBlending property to instruct unity to not to use heightmaps.

/main
Yao Xiaoling 6 年前
当前提交
fc9758a0
共有 3 个文件被更改,包括 86 次插入44 次删除
  1. 21
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Material/TerrainLit/TerrainLitUI.cs
  2. 12
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/TerrainLit/TerrainLit.shader
  3. 97
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/RenderPipelineResources/DefaultHDTerrainMaterial.mat

21
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Editor/Material/TerrainLit/TerrainLitUI.cs


{
public readonly GUIContent layersText = new GUIContent("Inputs");
public readonly GUIContent layerMapMaskText = new GUIContent("Layer Mask", "Layer mask");
public readonly GUIContent enableHeightBlending = new GUIContent("Enable Height Blending", "Enables layer blending using heightmaps.");
public readonly GUIContent heightTransition = new GUIContent("Height Transition", "Size in world units of the smooth transition between layers.");
}

public TerrainLitGUI()
{
m_PropertySuffixes[0] = "0";
m_PropertySuffixes[1] = "1";
m_PropertySuffixes[2] = "2";
m_PropertySuffixes[3] = "3";
}
// Density/opacity mode

// Height blend
MaterialProperty enableHeightBlending = null;
const string kEnableHeightBlending = "_EnableHeightBlending";
enableHeightBlending = FindProperty(kEnableHeightBlending, props, false);
heightTransition = FindProperty(kHeightTransition, props, false);
for (int i = 0; i < kMaxLayerCount; ++i)
{

EditorGUI.indentLevel++;
GUILayout.Label(styles.layersText, EditorStyles.boldLabel);
EditorGUI.indentLevel++;
m_MaterialEditor.ShaderProperty(heightTransition, styles.heightTransition);
EditorGUI.indentLevel--;
if (enableHeightBlending != null)
{
m_MaterialEditor.ShaderProperty(enableHeightBlending, styles.enableHeightBlending);
if (enableHeightBlending.floatValue > 0)
{
EditorGUI.indentLevel++;
m_MaterialEditor.ShaderProperty(heightTransition, styles.heightTransition);
EditorGUI.indentLevel--;
}
}
EditorGUI.indentLevel--;
}

12
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/TerrainLit/TerrainLit.shader


[HideInInspector] [ToggleUI] _OpacityAsDensity6("_OpacityAsDensity6", Float) = 0.0
[HideInInspector] [ToggleUI] _OpacityAsDensity7("_OpacityAsDensity7", Float) = 0.0
[ToggleUI] _EnableHeightBlending("Enable Height Blending", Float) = 1.0 // Hint Unity if heightmaps are ever used
_HeightTransition("Height Transition", Range(0, 1.0)) = 0.0
[HideInInspector] _Height0("Height 0", 2D) = "black" {}
[HideInInspector] _Height1("Height 1", 2D) = "black" {}

#pragma shader_feature _TERRAIN_NORMAL_MAP
#pragma shader_feature _TERRAIN_HEIGHT_MAP
// #pragma shader_feature _HEIGHT_BASED_BLEND // _HEIGHT_BASED_BLEND is implied if heightmap is used.
#pragma shader_feature _MASKMAP0
#pragma shader_feature _MASKMAP1
#pragma shader_feature _MASKMAP2
#pragma shader_feature _MASKMAP3
// #pragma shader_feature _HEIGHT_BASED_BLEND // _HEIGHT_BASED_BLEND is implied if heightmap is used.
//#pragma shader_feature _MASKMAP0
//#pragma shader_feature _MASKMAP1
//#pragma shader_feature _MASKMAP2
//#pragma shader_feature _MASKMAP3
#pragma shader_feature _DENSITY_MODE

97
ScriptableRenderPipeline/HDRenderPipeline/HDRP/RenderPipelineResources/DefaultHDTerrainMaterial.mat


m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _Control:
- _Control0:
- _HeightMap0:
- _Control1:
- _HeightMap1:
- _Height0:
- _HeightMap2:
- _Height1:
- _HeightMap3:
- _Height2:
- _MainTex:
- _Height3:
- _MaskMap0:
- _Height4:
- _MaskMap1:
- _Height5:
- _MaskMap2:
- _Height6:
- _MaskMap3:
- _Height7:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}

m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Normal4:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Normal5:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Normal6:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Normal7:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Splat0:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}

m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Splat4:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Splat5:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Splat6:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Splat7:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _AORemapMax0: 1
- _AORemapMax1: 1
- _AORemapMax2: 1
- _AORemapMax3: 1
- _AORemapMin0: 0
- _AORemapMin1: 0
- _AORemapMin2: 0
- _AORemapMin3: 0
- _EnableHeightBlending: 1
- _HeightAmplitude4: 0.02
- _HeightAmplitude5: 0.02
- _HeightAmplitude6: 0.02
- _HeightAmplitude7: 0.02
- _HeightTransition: 0
- _HeightCenter4: 0.5
- _HeightCenter5: 0.5
- _HeightCenter6: 0.5
- _HeightCenter7: 0.5
- _HeightTransition: 0.004
- _Metallic4: 0
- _Metallic5: 0
- _Metallic6: 0
- _Metallic7: 0
- _OpacityAsDensity4: 0
- _OpacityAsDensity5: 0
- _OpacityAsDensity6: 0
- _OpacityAsDensity7: 0
- _SmoothnessRemapMax0: 1
- _SmoothnessRemapMax1: 1
- _SmoothnessRemapMax2: 1
- _SmoothnessRemapMax3: 1
- _SmoothnessRemapMin0: 0
- _SmoothnessRemapMin1: 0
- _SmoothnessRemapMin2: 0
- _SmoothnessRemapMin3: 0
- _Smoothness4: 0
- _Smoothness5: 0
- _Smoothness6: 0
- _Smoothness7: 0
- _TexWorldScale0: 1
- _TexWorldScale1: 1
- _TexWorldScale2: 1
- _TexWorldScale3: 1
- _ZTestDepthEqualForOpaque: 4
- _ZTestDepthEqualForOpaque: 3
- _ZTestGBuffer: 4
- _ZWrite: 1
m_Colors:

正在加载...
取消
保存