diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index 369e5548dcd..e252ba3ba75 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -68,6 +68,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Rejecting history for ray traced reflections based on a threshold evaluated on the neighborhood of the sampled history. - Renamed "Environment" to "Reflection Probes" in tile/cluster debug menu. - Debug exposure in debug menu have been replace to debug exposure compensation in EV100 space and is always visible. +- Cookie are now supported in lightmaper. All lights casting cookie and baked will now include cookie influence. ## [7.3.0] - 2020-03-11 diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Upgrading-from-2019.3-to-2020.1.md b/com.unity.render-pipelines.high-definition/Documentation~/Upgrading-from-2019.3-to-2020.1.md index 8742701deb8..6cd48c9c77a 100644 --- a/com.unity.render-pipelines.high-definition/Documentation~/Upgrading-from-2019.3-to-2020.1.md +++ b/com.unity.render-pipelines.high-definition/Documentation~/Upgrading-from-2019.3-to-2020.1.md @@ -5,3 +5,7 @@ In the High Definition Render Pipeline (HDRP), some features work differently be ## Scene View Camera Settings From Unity 2020.1, the HDRP-specific settings of the scene view camera (anti-aliasing mode and stop NaNs) can be found in the same pop-up window as the standard scene camera settings, which are accessible by clicking the scene camera button on the toolbar of the scene window. These settings were previously in the HDRP preferences window (Edit > Preferences). + +## Cookie baking + +From Unity 2020.1, Cookie on light are not taken into account for the lightmaps / Lightprobes. This support is always enable with HDRP. \ No newline at end of file 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 791fbe90800..19986edf466 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 af3526dd800..cb3a5d59d1c 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)) @@ -722,12 +722,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()) @@ -737,7 +737,7 @@ static void DrawEmissionContent(SerializedHDLight serialized, Editor owner) } } - static void ShowCookieTextureWarnings(Texture cookie) + static void ShowCookieTextureWarnings(Texture cookie, bool useBaking) { if (cookie == null) return; @@ -767,12 +767,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; @@ -808,7 +810,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/Material/AxF/AxFData.hlsl b/com.unity.render-pipelines.high-definition/Runtime/Material/AxF/AxFData.hlsl index 8e919f6ddfe..b40ae677c35 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Material/AxF/AxFData.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/Material/AxF/AxFData.hlsl @@ -113,7 +113,7 @@ void GetSurfaceAndBuiltinData(FragInputs input, float3 V, inout PositionInputs p // Create mirrored UVs to hide flakes tiling surfaceData.flakesUV = _CarPaint2_FlakeTiling * UV0; - surfaceData.flakesMipLevel = _CarPaint2_BTFFlakeMap.CalculateLevelOfDetail(sampler_CarPaint2_BTFFlakeMap, surfaceData.flakesUV); + surfaceData.flakesMipLevel = CALCULATE_TEXTURE2D_LOD(_CarPaint2_BTFFlakeMap, sampler_CarPaint2_BTFFlakeMap, surfaceData.flakesUV); // TODO_FLAKES: this isn't really tiling if ((int(surfaceData.flakesUV.y) & 1) == 0) 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 79c13f2e614..44f1897e6cf 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs +++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs @@ -104,6 +104,9 @@ internal static Volume GetOrCreateDefaultVolume() readonly XRSystem m_XRSystem; bool m_FrameSettingsHistoryEnabled = false; +#if UNITY_EDITOR + bool m_PreviousDisableCookieForLightBaking = false; +#endif /// /// This functions allows the user to have an approximation of the number of rays that were traced for a given frame. @@ -690,6 +693,10 @@ void SetRenderingFeatures() Lightmapping.SetDelegate(GlobalIlluminationUtils.hdLightsDelegate); #if UNITY_EDITOR + // HDRP always enable baking of cookie by default + m_PreviousDisableCookieForLightBaking = UnityEditor.EditorSettings.disableCookiesInLightmapper; + UnityEditor.EditorSettings.disableCookiesInLightmapper = false; + SceneViewDrawMode.SetupDrawMode(); if (UnityEditor.PlayerSettings.colorSpace == ColorSpace.Gamma) @@ -780,6 +787,10 @@ void UnsetRenderingFeatures() GraphicsSettings.useScriptableRenderPipelineBatching = false; Lightmapping.ResetDelegate(); + +#if UNITY_EDITOR + UnityEditor.EditorSettings.disableCookiesInLightmapper = m_PreviousDisableCookieForLightBaking; +#endif } void InitializeDebugMaterials()