From 2cdf10de0ed246f58214c3ff1c64a194482fadc9 Mon Sep 17 00:00:00 2001 From: Wilfrid Girard Date: Mon, 7 Dec 2020 12:40:31 +0900 Subject: [PATCH] Hide URP Point Light Shadows under Scripting Define ENABLE_POINT_LIGHT_SHADOWS until it is OK to expose them from a Product perspective --- .../ProjectSettings/ProjectSettings.asset | 28 ++++++------- .../CHANGELOG.md | 3 -- .../UniversalRenderPipelineLightEditor.cs | 40 +++++++++++++++++-- .../AdditionalLightsShadowCasterPass.cs | 7 ++++ .../Runtime/UniversalRenderPipeline.cs | 5 +++ 5 files changed, 63 insertions(+), 20 deletions(-) diff --git a/TestProjects/UniversalGraphicsTest/ProjectSettings/ProjectSettings.asset b/TestProjects/UniversalGraphicsTest/ProjectSettings/ProjectSettings.asset index 4684b0af264..a39bb7047ce 100644 --- a/TestProjects/UniversalGraphicsTest/ProjectSettings/ProjectSettings.asset +++ b/TestProjects/UniversalGraphicsTest/ProjectSettings/ProjectSettings.asset @@ -565,20 +565,20 @@ PlayerSettings: webGLThreadsSupport: 0 webGLDecompressionFallback: 0 scriptingDefineSymbols: - 1: LWRP_DEBUG_STATIC_POSTFX - 4: LWRP_DEBUG_STATIC_POSTFX - 7: LWRP_DEBUG_STATIC_POSTFX - 13: LWRP_DEBUG_STATIC_POSTFX - 14: LWRP_DEBUG_STATIC_POSTFX - 18: LWRP_DEBUG_STATIC_POSTFX - 19: LWRP_DEBUG_STATIC_POSTFX - 21: LWRP_DEBUG_STATIC_POSTFX - 23: LWRP_DEBUG_STATIC_POSTFX - 25: LWRP_DEBUG_STATIC_POSTFX - 26: LWRP_DEBUG_STATIC_POSTFX - 27: LWRP_DEBUG_STATIC_POSTFX - 28: LWRP_DEBUG_STATIC_POSTFX - 29: LWRP_DEBUG_STATIC_POSTFX + 1: LWRP_DEBUG_STATIC_POSTFX;ENABLE_POINT_LIGHT_SHADOWS + 4: LWRP_DEBUG_STATIC_POSTFX;ENABLE_POINT_LIGHT_SHADOWS + 7: LWRP_DEBUG_STATIC_POSTFX;ENABLE_POINT_LIGHT_SHADOWS + 13: LWRP_DEBUG_STATIC_POSTFX;ENABLE_POINT_LIGHT_SHADOWS + 14: LWRP_DEBUG_STATIC_POSTFX;ENABLE_POINT_LIGHT_SHADOWS + 18: LWRP_DEBUG_STATIC_POSTFX;ENABLE_POINT_LIGHT_SHADOWS + 19: LWRP_DEBUG_STATIC_POSTFX;ENABLE_POINT_LIGHT_SHADOWS + 21: LWRP_DEBUG_STATIC_POSTFX;ENABLE_POINT_LIGHT_SHADOWS + 23: LWRP_DEBUG_STATIC_POSTFX;ENABLE_POINT_LIGHT_SHADOWS + 25: LWRP_DEBUG_STATIC_POSTFX;ENABLE_POINT_LIGHT_SHADOWS + 26: LWRP_DEBUG_STATIC_POSTFX;ENABLE_POINT_LIGHT_SHADOWS + 27: LWRP_DEBUG_STATIC_POSTFX;ENABLE_POINT_LIGHT_SHADOWS + 28: LWRP_DEBUG_STATIC_POSTFX;ENABLE_POINT_LIGHT_SHADOWS + 29: LWRP_DEBUG_STATIC_POSTFX;ENABLE_POINT_LIGHT_SHADOWS platformArchitecture: {} scriptingBackend: {} il2cppCompilerConfiguration: {} diff --git a/com.unity.render-pipelines.universal/CHANGELOG.md b/com.unity.render-pipelines.universal/CHANGELOG.md index 7567a4f5cbd..4cc5101cdc4 100644 --- a/com.unity.render-pipelines.universal/CHANGELOG.md +++ b/com.unity.render-pipelines.universal/CHANGELOG.md @@ -5,9 +5,6 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## [11.0.0] - 2020-10-21 -### Added -- Added real-time Point Light Shadows. - ### Added - Added a supported MSAA samples count check, so the actual supported MSAA samples count value can be assigned to RenderTexture descriptors. - Added the TerrainCompatible SubShader Tag. Use this Tag in your custom shader to tell Unity that the shader is compatible with the Terrain system. diff --git a/com.unity.render-pipelines.universal/Editor/UniversalRenderPipelineLightEditor.cs b/com.unity.render-pipelines.universal/Editor/UniversalRenderPipelineLightEditor.cs index af3125d9fbc..63a7ed39bbc 100644 --- a/com.unity.render-pipelines.universal/Editor/UniversalRenderPipelineLightEditor.cs +++ b/com.unity.render-pipelines.universal/Editor/UniversalRenderPipelineLightEditor.cs @@ -27,12 +27,19 @@ class Styles public readonly GUIContent DisabledLightWarning = EditorGUIUtility.TrTextContent("Lighting has been disabled in at least one Scene view. Any changes applied to lights in the Scene will not be updated in these views until Lighting has been enabled again."); public readonly GUIContent SunSourceWarning = EditorGUIUtility.TrTextContent("This light is set as the current Sun Source, which requires a directional light. Go to the Lighting Window's Environment settings to edit the Sun Source."); +#if ENABLE_POINT_LIGHT_SHADOWS +#else + // Temporarily disable Point Light Shadows until feature OK from Product perspective + public readonly GUIContent ShadowsNotSupportedWarning = EditorGUIUtility.TrTextContent("Realtime shadows for point lights are not supported. Either disable shadows or set the light mode to Baked."); +#endif + public static readonly GUIContent ShadowRealtimeSettings = EditorGUIUtility.TrTextContent("Realtime Shadows", "Settings for realtime direct shadows."); public static readonly GUIContent ShadowStrength = EditorGUIUtility.TrTextContent("Strength", "Controls how dark the shadows cast by the light will be."); public static readonly GUIContent ShadowNearPlane = EditorGUIUtility.TrTextContent("Near Plane", "Controls the value for the near clip plane when rendering shadows. Currently clamped to 0.1 units or 1% of the lights range property, whichever is lower."); public static readonly GUIContent ShadowNormalBias = EditorGUIUtility.TrTextContent("Normal", "Controls the distance shadow caster vertices are offset along their normals when rendering shadow maps. Currently ignored for Point Lights."); public static GUIContent shadowBias = EditorGUIUtility.TrTextContent("Bias", "Select if the Bias should use the settings from the Pipeline Asset or Custom settings."); + public static int[] optionDefaultValues = { 0, 1 }; public static GUIContent[] displayedDefaultOptions = @@ -55,7 +62,13 @@ class Styles public bool areaOptionsValue { get { return typeIsSame && (lightProperty.type == LightType.Rectangle || lightProperty.type == LightType.Disc); } } // Area light shadows not supported +#if ENABLE_POINT_LIGHT_SHADOWS public bool runtimeOptionsValue { get { return typeIsSame && (lightProperty.type != LightType.Rectangle && !settings.isCompletelyBaked); } } +#else + // Temporarily disable Point Light Shadows until feature OK from Product perspective + public bool runtimeOptionsValue { get { return typeIsSame && (lightProperty.type != LightType.Rectangle && lightProperty.type != LightType.Point && !settings.isCompletelyBaked); } } +#endif + public bool bakedShadowRadius { get { return typeIsSame && (lightProperty.type == LightType.Point || lightProperty.type == LightType.Spot) && settings.isBakedOrMixed; } } public bool bakedShadowAngle { get { return typeIsSame && lightProperty.type == LightType.Directional && settings.isBakedOrMixed; } } public bool shadowOptionsValue { get { return shadowTypeIsSame && lightProperty.shadows != LightShadows.None; } } @@ -66,6 +79,20 @@ class Styles public bool isShadowEnabled { get { return settings.shadowsType.intValue != 0; } } +#if ENABLE_POINT_LIGHT_SHADOWS +#else + // Temporarily disable Point Light Shadows until feature OK from Product perspective + public bool realtimeShadowsWarningValue + { + get + { + return typeIsSame && lightProperty.type == LightType.Point && + shadowTypeIsSame && isShadowEnabled && + lightmappingTypeIsSame && !settings.isCompletelyBaked; + } + } +#endif + UniversalAdditionalLightData m_AdditionalLightData; SerializedObject m_AdditionalLightDataSO; @@ -114,11 +141,11 @@ public override void OnInspectorGUI() // we want the fade group to stay hidden. using (var group = new EditorGUILayout.FadeGroupScope(1.0f - m_AnimDirOptions.faded)) if (group.visible) - #if UNITY_2020_1_OR_NEWER +#if UNITY_2020_1_OR_NEWER settings.DrawRange(); - #else +#else settings.DrawRange(m_AnimAreaOptions.target); - #endif +#endif // Spot angle using (var group = new EditorGUILayout.FadeGroupScope(m_AnimSpotOptions.faded)) @@ -312,6 +339,13 @@ void ShadowsGUI() if (bakingWarningValue) EditorGUILayout.HelpBox(s_Styles.BakingWarning.text, MessageType.Warning); +#if ENABLE_POINT_LIGHT_SHADOWS +#else + // Temporarily disable Point Light Shadows until feature is OK from Product perspective + if (realtimeShadowsWarningValue) + EditorGUILayout.HelpBox(s_Styles.ShadowsNotSupportedWarning.text, MessageType.Warning); +#endif + EditorGUILayout.Space(); } diff --git a/com.unity.render-pipelines.universal/Runtime/Passes/AdditionalLightsShadowCasterPass.cs b/com.unity.render-pipelines.universal/Runtime/Passes/AdditionalLightsShadowCasterPass.cs index 56ddee73d9f..ca9f04ddf4d 100644 --- a/com.unity.render-pipelines.universal/Runtime/Passes/AdditionalLightsShadowCasterPass.cs +++ b/com.unity.render-pipelines.universal/Runtime/Passes/AdditionalLightsShadowCasterPass.cs @@ -582,6 +582,13 @@ bool IsValidShadowCastingLight(ref LightData lightData, int i) if (shadowLight.lightType == LightType.Directional) return false; +#if ENABLE_POINT_LIGHT_SHADOWS +#else + // Temporarily disable Point Light Shadows until feature is OK from Product perspective + if (shadowLight.lightType == LightType.Point) + return false; +#endif + Light light = shadowLight.light; return light != null && light.shadows != LightShadows.None && !Mathf.Approximately(light.shadowStrength, 0.0f); } diff --git a/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipeline.cs b/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipeline.cs index 276a73749a2..94c2347de1b 100644 --- a/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipeline.cs +++ b/com.unity.render-pipelines.universal/Runtime/UniversalRenderPipeline.cs @@ -872,7 +872,12 @@ static void InitializeRenderingData(UniversalRenderPipelineAsset settings, ref C Light light = visibleLights[i].light; // UniversalRP doesn't support additional directional light shadows yet +#if ENABLE_POINT_LIGHT_SHADOWS if ((visibleLights[i].lightType == LightType.Spot || visibleLights[i].lightType == LightType.Point) && light != null && light.shadows != LightShadows.None) +#else + // Temporarily disable Point Light Shadows until feature OK from Product perspective + if ((visibleLights[i].lightType == LightType.Spot /*|| visibleLights[i].lightType == LightType.Point*/) && light != null && light.shadows != LightShadows.None) +#endif { additionalLightsCastShadows = true; break;