浏览代码

HDRenderPipeline: Move Density/opacity of Layered material in standard mode

/main
sebastienlagarde 8 年前
当前提交
24f0a144
共有 2 个文件被更改,包括 12 次插入23 次删除
  1. 33
      Assets/ScriptableRenderLoop/HDRenderPipeline/Material/LayeredLit/Editor/LayeredLitUI.cs
  2. 2
      Assets/ScriptableRenderLoop/HDRenderPipeline/Material/Lit/LitData.hlsl

33
Assets/ScriptableRenderLoop/HDRenderPipeline/Material/LayeredLit/Editor/LayeredLitUI.cs


{
public readonly GUIContent[] layerLabels =
{
new GUIContent("Layer 0"),
new GUIContent("Main layer"),
public readonly GUIContent[] baseLayerLabels =
{
new GUIContent("Base Layer"),
new GUIContent("Layer 1"),
new GUIContent("Layer 2"),
new GUIContent("Layer 3"),
};
public readonly GUIStyle[] layerLabelColors =
{

public readonly GUIContent BaseInfluenceText = new GUIContent("Base influence", "Base influence.");
public readonly GUIContent DensityOpacityInfluenceText = new GUIContent("Density / Opacity", "Density / Opacity");
public readonly GUIContent useHeightBasedBlendText = new GUIContent("Use Height Based Blend", "Layer will be blended with the underlying layer based on the height.");
public readonly GUIContent useBaseLayerModeText = new GUIContent("Use Base Mode", "Switch between regular layers mode and base/layers mode");
public readonly GUIContent useBaseLayerModeText = new GUIContent("Main Layer Influence", "Switch between regular layers mode and base/layers mode");
public readonly GUIContent heightOffsetText = new GUIContent("Height Offset", "Height offset from the previous layer.");
public readonly GUIContent inheritBaseLayerText = new GUIContent("Inherit Base Layer Normal", "Inherit the normal from the base layer.");
public readonly GUIContent heightFactorText = new GUIContent("Height Multiplier", "Scale applied to the height of the layer.");

bool baseLayerModeEnable = useBaseLayerMode.floatValue > 0.0f;
EditorGUILayout.LabelField(baseLayerModeEnable ? styles.baseLayerLabels[layerIndex] : styles.layerLabels[layerIndex], styles.layerLabelColors[layerIndex]);
EditorGUILayout.LabelField(styles.layerLabels[layerIndex], styles.layerLabelColors[layerIndex]);
EditorGUI.indentLevel++;

int paramIndex = layerIndex - 1;
EditorGUILayout.LabelField(styles.DensityOpacityInfluenceText, EditorStyles.label);
EditorGUI.indentLevel++;
m_MaterialEditor.ShaderProperty(opacityAsDensity[paramIndex], styles.opacityAsDensityText);
m_MaterialEditor.ShaderProperty(minimumOpacity[paramIndex], styles.minimumOpacityText);
EditorGUI.indentLevel--;
if (baseLayerModeEnable)
{
EditorGUILayout.LabelField(styles.BaseInfluenceText, EditorStyles.label);

{
m_MaterialEditor.ShaderProperty(inheritBaseHeight[paramIndex], styles.inheritBaseHeightText);
}
EditorGUI.indentLevel--;
EditorGUILayout.LabelField(styles.DensityOpacityInfluenceText, EditorStyles.label);
EditorGUI.indentLevel++;
m_MaterialEditor.ShaderProperty(opacityAsDensity[paramIndex], styles.opacityAsDensityText);
m_MaterialEditor.ShaderProperty(minimumOpacity[paramIndex], styles.minimumOpacityText);
EditorGUI.indentLevel--;
}

2
Assets/ScriptableRenderLoop/HDRenderPipeline/Material/Lit/LitData.hlsl


inputMaskValues = saturate(inputMaskValues + input.color.rgb * 2.0 - 1.0);
#endif
#if defined(_BASE_LAYER_MODE)
float3 minOpaParam = float3(_MinimumOpacity1, _MinimumOpacity2, _MinimumOpacity3);
float3 remapedOpacity = (float3(1.0, 1.0, 1.0) - minOpaParam) * inputAlphaMask.yzw + minOpaParam; // Remap opacity mask from [0..1] to [minOpa..1]
float3 opacityAsDensity = saturate((inputAlphaMask.yzw - (float3(1.0, 1.0, 1.0) - inputMaskValues)) * 20.0);

#endif
#if defined(_HEIGHT_BASED_BLEND)
float height0 = SampleHeightmap0(layerTexCoord);

正在加载...
取消
保存