diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index 56273def7b3..b7ac022f866 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] ### Added +- Enable by default Cookie for Light Baking +- Add warning if disabled and use Baking & Cookies - Ray tracing support for VR single-pass - Added sharpen filter shader parameter and UI for TemporalAA to control image quality instead of hardcoded value - Added frame settings option for custom post process and custom passes as well as custom color buffer format option. diff --git a/com.unity.render-pipelines.high-definition/Editor/Lighting/HDLightUI.Skin.cs b/com.unity.render-pipelines.high-definition/Editor/Lighting/HDLightUI.Skin.cs index 3ca65454874..616cbd41ff9 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Lighting/HDLightUI.Skin.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Lighting/HDLightUI.Skin.cs @@ -42,6 +42,7 @@ sealed class Styles public readonly GUIContent cookieTextureTypeError = new GUIContent("HDRP does not support the Cookie Texture type, only Default is supported.", EditorGUIUtility.IconContent("console.warnicon").image); public readonly string cookieNonPOT = "HDRP does not support non power of two cookie textures."; public readonly string cookieTooSmall = "Min texture size for cookies is 2x2 pixels."; + public readonly string cookieBaking = "Light Baking for cookies disabled on the Project Settings."; // Additional light data diff --git a/com.unity.render-pipelines.high-definition/Editor/Lighting/HDLightUI.cs b/com.unity.render-pipelines.high-definition/Editor/Lighting/HDLightUI.cs index e86739f3204..ab94a55bf02 100644 --- a/com.unity.render-pipelines.high-definition/Editor/Lighting/HDLightUI.cs +++ b/com.unity.render-pipelines.high-definition/Editor/Lighting/HDLightUI.cs @@ -410,7 +410,7 @@ static void DrawShapeContent(SerializedHDLight serialized, Editor owner) case AreaLightShape.Disc: //draw the built-in area light control at the moment as everything is handled by built-in serialized.settings.DrawArea(); - serialized.displayAreaLightEmissiveMesh.boolValue = false; //force deactivate emissive mesh for Disc (not supported) + serialized.displayAreaLightEmissiveMesh.boolValue = false; //force deactivate emissive mesh for Disc (not supported) break; case (AreaLightShape)(-1): //multiple different values using (new EditorGUI.DisabledScope(true)) @@ -723,12 +723,12 @@ static void DrawEmissionContent(SerializedHDLight serialized, Editor owner) EditorGUI.indentLevel--; } - ShowCookieTextureWarnings(serialized.settings.cookie); + ShowCookieTextureWarnings(serialized.settings.cookie, serialized.settings.isCompletelyBaked || serialized.settings.isBakedOrMixed); } else if (serialized.areaLightShape == AreaLightShape.Rectangle || serialized.areaLightShape == AreaLightShape.Disc) { EditorGUILayout.ObjectField( serialized.areaLightCookie, s_Styles.areaLightCookie ); - ShowCookieTextureWarnings(serialized.areaLightCookie.objectReferenceValue as Texture); + ShowCookieTextureWarnings(serialized.areaLightCookie.objectReferenceValue as Texture, serialized.settings.isCompletelyBaked || serialized.settings.isBakedOrMixed); } if (EditorGUI.EndChangeCheck()) @@ -738,7 +738,7 @@ static void DrawEmissionContent(SerializedHDLight serialized, Editor owner) } } - static void ShowCookieTextureWarnings(Texture cookie) + static void ShowCookieTextureWarnings(Texture cookie, bool useBaking) { if (cookie == null) return; @@ -768,12 +768,14 @@ static void ShowCookieTextureWarnings(Texture cookie) } } + if (useBaking && UnityEditor.EditorSettings.disableCookiesInLightmapper) + EditorGUILayout.HelpBox(s_Styles.cookieBaking, MessageType.Warning); if (cookie.width != cookie.height) EditorGUILayout.HelpBox(s_Styles.cookieNonPOT, MessageType.Warning); if (cookie.width < LightCookieManager.k_MinCookieSize || cookie.height < LightCookieManager.k_MinCookieSize) EditorGUILayout.HelpBox(s_Styles.cookieTooSmall, MessageType.Warning); } - + static void DrawEmissionAdvancedContent(SerializedHDLight serialized, Editor owner) { HDLightType lightType = serialized.type; @@ -809,7 +811,7 @@ static void DrawEmissionAdvancedContent(SerializedHDLight serialized, Editor own bool showSubArea = serialized.displayAreaLightEmissiveMesh.boolValue && !serialized.displayAreaLightEmissiveMesh.hasMultipleDifferentValues; ++EditorGUI.indentLevel; - + Rect lineRect = EditorGUILayout.GetControlRect(); ShadowCastingMode newCastShadow; EditorGUI.showMixedValue = serialized.areaLightEmissiveMeshCastShadow.hasMultipleDifferentValues; diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs index 61287f00402..75c9c7db025 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs @@ -103,6 +103,7 @@ internal static Volume GetOrCreateDefaultVolume() readonly XRSystem m_XRSystem; bool m_FrameSettingsHistoryEnabled = false; + bool m_DisableCookieForLightBaking = false; /// /// This functions allows the user to have an approximation of the number of rays that were traced for a given frame. @@ -660,6 +661,9 @@ void SetRenderingFeatures() GraphicsSettings.lightsUseLinearIntensity = true; GraphicsSettings.lightsUseColorTemperature = true; + m_DisableCookieForLightBaking = UnityEditor.EditorSettings.disableCookiesInLightmapper; + UnityEditor.EditorSettings.disableCookiesInLightmapper = false; + GraphicsSettings.useScriptableRenderPipelineBatching = m_Asset.enableSRPBatcher; SupportedRenderingFeatures.active = new SupportedRenderingFeatures() @@ -776,6 +780,8 @@ void UnsetRenderingFeatures() // Reset srp batcher state just in case GraphicsSettings.useScriptableRenderPipelineBatching = false; + UnityEditor.EditorSettings.disableCookiesInLightmapper = m_DisableCookieForLightBaking; + Lightmapping.ResetDelegate(); }