浏览代码

Merge pull request #1536 from Unity-Technologies/lw/lw-pipeline-asset-inspector

LW pipeline asset inspector UI
/main
GitHub 7 年前
当前提交
8fbd1282
共有 4 个文件被更改,包括 48 次插入81 次删除
  1. 7
      com.unity.render-pipelines.core/CoreRP/Editor/Shadow/ShadowCascadeSplitGUI.cs
  2. 1
      com.unity.render-pipelines.lightweight/CHANGELOG.md
  3. 3
      com.unity.render-pipelines.lightweight/LWRP/Data/LightweightPipelineAsset.cs
  4. 118
      com.unity.render-pipelines.lightweight/LWRP/Editor/LightweightPipelineAssetEditor.cs

7
com.unity.render-pipelines.core/CoreRP/Editor/Shadow/ShadowCascadeSplitGUI.cs


*/
public static void HandleCascadeSliderGUI(ref float[] normalizedCascadePartitions)
{
EditorGUILayout.LabelField("Cascade splits");
EditorGUILayout.BeginHorizontal();
GUILayout.Space(EditorGUI.indentLevel * 15f);
EditorGUILayout.EndHorizontal();
float currentX = sliderRect.x;
float cascadeBoxStartY = sliderRect.y + kSliderbarTopMargin;

1
com.unity.render-pipelines.lightweight/CHANGELOG.md


### Changed
- Screenspace shadow resolve is not only done when rendering shadow cascades
- Updated the UI for the Lighweight pipeline asset
### Fixed
- Fixed UnityPerDraw CB layout

3
com.unity.render-pipelines.lightweight/LWRP/Data/LightweightPipelineAsset.cs


[SerializeField] bool m_LocalShadowsSupported = true;
[SerializeField] ShadowResolution m_LocalShadowsAtlasResolution = ShadowResolution._512;
[SerializeField] bool m_SoftShadowsSupported = false;
[SerializeField] bool m_CustomShaderVariantStrippingSettings = false;
[SerializeField] bool m_KeepAdditionalLightVariants = true;
[SerializeField] bool m_KeepVertexLightVariants = true;
[SerializeField] bool m_KeepDirectionalShadowVariants = true;

public bool customShaderVariantStripping
{
get { return m_CustomShaderVariantStrippingSettings; }
get { return false; }
}
public bool keepAdditionalLightVariants

118
com.unity.render-pipelines.lightweight/LWRP/Editor/LightweightPipelineAssetEditor.cs


{
internal class Styles
{
public static GUIContent generalSettingsLabel = new GUIContent("General");
public static GUIContent directionalShadowLabel = new GUIContent("Directional Shadows");
public static GUIContent localShadowLabel = new GUIContent("Local Shadows");
public static GUIContent capabilitiesLabel = new GUIContent("Capabilities");
public static GUIContent renderScaleLabel = new GUIContent("Render Scale", "Scales the camera render target allowing the game to render at a resolution different than native resolution. UI is always rendered at native resolution. When in VR mode, VR scaling configuration is used instead.");

public static GUIContent requireDepthTexture = new GUIContent("Depth Texture", "If enabled the pipeline will generate camera's depth that can be bound in shaders as _CameraDepthTexture.");
public static GUIContent requireSoftParticles = new GUIContent("Soft Particles", "If enabled the pipeline will enable SOFT_PARTICLES keyword.");
public static GUIContent requireSoftParticles = new GUIContent("Soft Particles", "If enabled the pipeline will enable SOFT_PARTICLES keyword.\nNeeds Depth Texture to be enabled.");
public static GUIContent requireOpaqueTexture = new GUIContent("Opaque Texture", "If enabled the pipeline will copy the screen to texture after opaque objects are drawn. For transparent objects this can be bound in shaders as _CameraOpaqueTexture.");

public static GUIContent dynamicBatching = new GUIContent("Dynamic Batching", "If enabled the pipeline will batch drawcalls with few triangles together by copying their vertex buffers into a shared buffer on a per-frame basis.");
public static GUIContent supportsSoftShadows = new GUIContent("Soft Shadows", "If enabled pipeline will perform shadow filtering. Otherwise all lights that cast shadows will fallback to perform a single shadow sample.");
public static GUIContent supportsDirectionalShadows = new GUIContent("Directional Shadows", "If enabled shadows will be supported for directional lights.");
public static GUIContent supportsSoftShadows = new GUIContent("Soft Shadows", "If enabled pipeline will perform shadow filtering. Otherwise all lights that cast shadows will fallback to perform a single shadow sample.\nNeeds either Directional or Local Shadows to be enabled in the Capabilities section.");
public static GUIContent supportsDirectionalShadows = new GUIContent("Directional Shadows", "If enabled shadows will be supported for directional lights.\nNeeds Directional Shadows to be enabled in the Capabilities section.");
public static GUIContent shadowDistance = new GUIContent("Distance", "Max shadow rendering distance.");

public static GUIContent shadowCascadeSplit = new GUIContent("Cascades Split",
"Percentages to split shadow volume");
public static GUIContent supportsLocalShadows = new GUIContent("Local Shadows", "If enabled shadows will be supported for spot lights.");
public static GUIContent supportsLocalShadows = new GUIContent("Local Shadows", "If enabled shadows will be supported for spot lights.\nNeeds Local Shadows to be enabled in the Capabilities section.");
public static GUIContent localShadowsAtlasResolution = new GUIContent("Atlas Resolution",
"All local lights are packed into a single atlas. This setting controls the atlas size.");

SerializedProperty m_LocalShadowsAtlasResolutionProp;
SerializedProperty m_CustomShaderVariantStripSettingsProp;
SerializedProperty m_KeepAdditionalLightsProp;
SerializedProperty m_KeepVertexLightsProp;
SerializedProperty m_KeepDirectionalShadowsProp;
SerializedProperty m_KeepLocalShadowsProp;
SerializedProperty m_KeepSoftShadowsProp;
public override void OnInspectorGUI()
{

DrawRenderingSettings();
DrawShadowSettings();
DrawStrippingSettings();
DrawCapabilitiesSettings();
DrawGeneralSettings();
serializedObject.ApplyModifiedProperties();
}

m_LocalShadowsAtlasResolutionProp = serializedObject.FindProperty("m_LocalShadowsAtlasResolution");
m_SoftShadowsSupportedProp = serializedObject.FindProperty("m_SoftShadowsSupported");
m_CustomShaderVariantStripSettingsProp = serializedObject.FindProperty("m_CustomShaderVariantStrippingSettings");
m_KeepAdditionalLightsProp = serializedObject.FindProperty("m_KeepAdditionalLightVariants");
m_KeepVertexLightsProp = serializedObject.FindProperty("m_KeepVertexLightVariants");
m_KeepDirectionalShadowsProp = serializedObject.FindProperty("m_KeepDirectionalShadowVariants");
m_KeepLocalShadowsProp = serializedObject.FindProperty("m_KeepLocalShadowVariants");
m_KeepSoftShadowsProp = serializedObject.FindProperty("m_KeepSoftShadowVariants");
m_ShowSoftParticles.valueChanged.AddListener(Repaint);
m_ShowSoftParticles.value = m_RequireSoftParticlesProp.boolValue;
m_ShowOpaqueTextureScale.valueChanged.AddListener(Repaint);

m_ShowOpaqueTextureScale.target = m_RequireOpaqueTextureProp.boolValue;
}
void DrawAnimatedProperty(SerializedProperty prop, GUIContent content, AnimBool animation)
void DrawGeneralSettings()
using (var group = new EditorGUILayout.FadeGroupScope(animation.faded))
if (group.visible)
EditorGUILayout.PropertyField(prop, content);
}
void DrawAnimatedPopup(SerializedProperty prop, GUIContent content, string[] options, AnimBool animation)
{
using (var group = new EditorGUILayout.FadeGroupScope(animation.faded))
if (group.visible)
CoreEditorUtils.DrawPopup(content, prop, options);
}
void DrawRenderingSettings()
{
EditorGUILayout.Space();
EditorGUILayout.LabelField(Styles.renderingLabel, EditorStyles.boldLabel);
EditorGUILayout.LabelField(Styles.generalSettingsLabel, EditorStyles.boldLabel);
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField(Styles.renderScaleLabel);
m_RenderScale.floatValue = EditorGUILayout.Slider(m_RenderScale.floatValue, k_MinRenderScale, k_MaxRenderScale);
EditorGUILayout.EndHorizontal();
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField(Styles.maxPixelLightsLabel);
m_MaxPixelLights.intValue = EditorGUILayout.IntSlider(m_MaxPixelLights.intValue, 0, k_MaxSupportedPixelLights);
EditorGUILayout.EndHorizontal();
EditorGUILayout.PropertyField(m_SupportsVertexLightProp, Styles.enableVertexLightLabel);
EditorGUILayout.PropertyField(m_RequireDepthTextureProp, Styles.requireDepthTexture);
DrawAnimatedProperty(m_RequireSoftParticlesProp, Styles.requireSoftParticles, m_ShowSoftParticles);
EditorGUILayout.PropertyField(m_RequireOpaqueTextureProp, Styles.requireOpaqueTexture);
DrawAnimatedPopup(m_OpaqueDownsamplingProp, Styles.opaqueDownsampling, Styles.opaqueDownsamplingOptions, m_ShowOpaqueTextureScale);
EditorGUILayout.PropertyField(m_HDR, Styles.hdrContent);
EditorGUILayout.PropertyField(m_MSAA, Styles.msaaContent);
EditorGUILayout.PropertyField(m_SupportsDynamicBatching, Styles.dynamicBatching);
EditorGUI.indentLevel--;
EditorGUILayout.Space();
m_RenderScale.floatValue = EditorGUILayout.Slider(Styles.renderScaleLabel, m_RenderScale.floatValue, k_MinRenderScale, k_MaxRenderScale);
m_MaxPixelLights.intValue = EditorGUILayout.IntSlider(Styles.maxPixelLightsLabel, m_MaxPixelLights.intValue, 0, k_MaxSupportedPixelLights);
}
void DrawShadowSettings()
{
EditorGUILayout.LabelField(Styles.shadowLabel, EditorStyles.boldLabel);
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(m_DirectionalShadowsSupportedProp, Styles.supportsDirectionalShadows);
EditorGUILayout.LabelField(Styles.directionalShadowLabel);
EditorGUILayout.FloatField(Styles.shadowDistance, m_ShadowDistanceProp.floatValue));
EditorGUILayout.FloatField(Styles.shadowDistance, m_ShadowDistanceProp.floatValue));
CoreEditorUtils.DrawPopup(Styles.shadowCascades, m_ShadowCascadesProp, Styles.shadowCascadeOptions);
ShadowCascades cascades = (ShadowCascades)m_ShadowCascadesProp.intValue;

EditorGUILayout.Space();
}
EditorGUILayout.PropertyField(m_LocalShadowSupportedProp, Styles.supportsLocalShadows);
EditorGUILayout.LabelField(Styles.localShadowLabel);
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(m_LocalShadowsAtlasResolutionProp, Styles.localShadowsAtlasResolution);
EditorGUI.indentLevel--;

EditorGUILayout.Space();
}
void DrawStrippingSettings()
void DrawCapabilitiesSettings()
EditorGUILayout.LabelField(StrippingStyles.strippingLabel, EditorStyles.boldLabel);
EditorGUILayout.LabelField(Styles.capabilitiesLabel, EditorStyles.boldLabel);
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(m_SupportsVertexLightProp, Styles.enableVertexLightLabel);
EditorGUILayout.PropertyField(m_RequireDepthTextureProp, Styles.requireDepthTexture);
EditorGUI.BeginDisabledGroup(!m_RequireDepthTextureProp.boolValue);
EditorGUILayout.PropertyField(m_RequireSoftParticlesProp, Styles.requireSoftParticles);
EditorGUI.EndDisabledGroup();
EditorGUILayout.PropertyField(m_RequireOpaqueTextureProp, Styles.requireOpaqueTexture);
CoreEditorUtils.DrawPopup(StrippingStyles.pipelineCapabilitiesLabel, m_CustomShaderVariantStripSettingsProp, StrippingStyles.strippingOptions);
if (m_CustomShaderVariantStripSettingsProp.boolValue)
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(m_KeepAdditionalLightsProp, StrippingStyles.localLightsLabel);
EditorGUILayout.PropertyField(m_KeepVertexLightsProp, StrippingStyles.vertexLightsLabel);
EditorGUILayout.PropertyField(m_KeepDirectionalShadowsProp, StrippingStyles.directionalShadowsLabel);
EditorGUILayout.PropertyField(m_KeepLocalShadowsProp, StrippingStyles.localShadowsLabel);
EditorGUILayout.PropertyField(m_KeepSoftShadowsProp, StrippingStyles.softShadowsLabel);
EditorGUI.indentLevel--;
}
EditorGUI.BeginDisabledGroup(!m_RequireOpaqueTextureProp.boolValue);
EditorGUILayout.PropertyField(m_OpaqueDownsamplingProp, Styles.opaqueDownsampling);
EditorGUI.EndDisabledGroup();
EditorGUI.indentLevel--;
EditorGUILayout.PropertyField(m_HDR, Styles.hdrContent);
EditorGUILayout.PropertyField(m_MSAA, Styles.msaaContent);
EditorGUILayout.PropertyField(m_SupportsDynamicBatching, Styles.dynamicBatching);
EditorGUILayout.PropertyField(m_DirectionalShadowsSupportedProp, Styles.supportsDirectionalShadows);
EditorGUILayout.PropertyField(m_LocalShadowSupportedProp, Styles.supportsLocalShadows);
}
}
}
正在加载...
取消
保存