Skip to content

Commit 8598f49

Browse files
authored
Enable Light Baking Cookies by default + Warning (#79)
* Enable * Fix typo
1 parent 7bb0afd commit 8598f49

File tree

4 files changed

+17
-6
lines changed

4 files changed

+17
-6
lines changed

com.unity.render-pipelines.high-definition/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77
## [Unreleased]
88

99
### Added
10+
- Enable by default Cookie for Light Baking
11+
- Add warning if disabled and use Baking & Cookies
1012
- Ray tracing support for VR single-pass
1113
- Added sharpen filter shader parameter and UI for TemporalAA to control image quality instead of hardcoded value
1214
- Added frame settings option for custom post process and custom passes as well as custom color buffer format option.

com.unity.render-pipelines.high-definition/Editor/Lighting/HDLightUI.Skin.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ sealed class Styles
4242
public readonly GUIContent cookieTextureTypeError = new GUIContent("HDRP does not support the Cookie Texture type, only Default is supported.", EditorGUIUtility.IconContent("console.warnicon").image);
4343
public readonly string cookieNonPOT = "HDRP does not support non power of two cookie textures.";
4444
public readonly string cookieTooSmall = "Min texture size for cookies is 2x2 pixels.";
45+
public readonly string cookieBaking = "Light Baking for cookies disabled on the Project Settings.";
4546

4647

4748
// Additional light data

com.unity.render-pipelines.high-definition/Editor/Lighting/HDLightUI.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ static void DrawShapeContent(SerializedHDLight serialized, Editor owner)
410410
case AreaLightShape.Disc:
411411
//draw the built-in area light control at the moment as everything is handled by built-in
412412
serialized.settings.DrawArea();
413-
serialized.displayAreaLightEmissiveMesh.boolValue = false; //force deactivate emissive mesh for Disc (not supported)
413+
serialized.displayAreaLightEmissiveMesh.boolValue = false; //force deactivate emissive mesh for Disc (not supported)
414414
break;
415415
case (AreaLightShape)(-1): //multiple different values
416416
using (new EditorGUI.DisabledScope(true))
@@ -722,12 +722,12 @@ static void DrawEmissionContent(SerializedHDLight serialized, Editor owner)
722722
EditorGUI.indentLevel--;
723723
}
724724

725-
ShowCookieTextureWarnings(serialized.settings.cookie);
725+
ShowCookieTextureWarnings(serialized.settings.cookie, serialized.settings.isCompletelyBaked || serialized.settings.isBakedOrMixed);
726726
}
727727
else if (serialized.areaLightShape == AreaLightShape.Rectangle || serialized.areaLightShape == AreaLightShape.Disc)
728728
{
729729
EditorGUILayout.ObjectField( serialized.areaLightCookie, s_Styles.areaLightCookie );
730-
ShowCookieTextureWarnings(serialized.areaLightCookie.objectReferenceValue as Texture);
730+
ShowCookieTextureWarnings(serialized.areaLightCookie.objectReferenceValue as Texture, serialized.settings.isCompletelyBaked || serialized.settings.isBakedOrMixed);
731731
}
732732

733733
if (EditorGUI.EndChangeCheck())
@@ -737,7 +737,7 @@ static void DrawEmissionContent(SerializedHDLight serialized, Editor owner)
737737
}
738738
}
739739

740-
static void ShowCookieTextureWarnings(Texture cookie)
740+
static void ShowCookieTextureWarnings(Texture cookie, bool useBaking)
741741
{
742742
if (cookie == null)
743743
return;
@@ -767,12 +767,14 @@ static void ShowCookieTextureWarnings(Texture cookie)
767767
}
768768
}
769769

770+
if (useBaking && UnityEditor.EditorSettings.disableCookiesInLightmapper)
771+
EditorGUILayout.HelpBox(s_Styles.cookieBaking, MessageType.Warning);
770772
if (cookie.width != cookie.height)
771773
EditorGUILayout.HelpBox(s_Styles.cookieNonPOT, MessageType.Warning);
772774
if (cookie.width < LightCookieManager.k_MinCookieSize || cookie.height < LightCookieManager.k_MinCookieSize)
773775
EditorGUILayout.HelpBox(s_Styles.cookieTooSmall, MessageType.Warning);
774776
}
775-
777+
776778
static void DrawEmissionAdvancedContent(SerializedHDLight serialized, Editor owner)
777779
{
778780
HDLightType lightType = serialized.type;
@@ -808,7 +810,7 @@ static void DrawEmissionAdvancedContent(SerializedHDLight serialized, Editor own
808810

809811
bool showSubArea = serialized.displayAreaLightEmissiveMesh.boolValue && !serialized.displayAreaLightEmissiveMesh.hasMultipleDifferentValues;
810812
++EditorGUI.indentLevel;
811-
813+
812814
Rect lineRect = EditorGUILayout.GetControlRect();
813815
ShadowCastingMode newCastShadow;
814816
EditorGUI.showMixedValue = serialized.areaLightEmissiveMeshCastShadow.hasMultipleDifferentValues;

com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ internal static Volume GetOrCreateDefaultVolume()
103103
readonly XRSystem m_XRSystem;
104104

105105
bool m_FrameSettingsHistoryEnabled = false;
106+
bool m_DisableCookieForLightBaking = false;
106107

107108
/// <summary>
108109
/// This functions allows the user to have an approximation of the number of rays that were traced for a given frame.
@@ -671,6 +672,9 @@ void SetRenderingFeatures()
671672
GraphicsSettings.lightsUseLinearIntensity = true;
672673
GraphicsSettings.lightsUseColorTemperature = true;
673674

675+
m_DisableCookieForLightBaking = UnityEditor.EditorSettings.disableCookiesInLightmapper;
676+
UnityEditor.EditorSettings.disableCookiesInLightmapper = false;
677+
674678
GraphicsSettings.useScriptableRenderPipelineBatching = m_Asset.enableSRPBatcher;
675679

676680
SupportedRenderingFeatures.active = new SupportedRenderingFeatures()
@@ -787,6 +791,8 @@ void UnsetRenderingFeatures()
787791
// Reset srp batcher state just in case
788792
GraphicsSettings.useScriptableRenderPipelineBatching = false;
789793

794+
UnityEditor.EditorSettings.disableCookiesInLightmapper = m_DisableCookieForLightBaking;
795+
790796
Lightmapping.ResetDelegate();
791797
}
792798

0 commit comments

Comments
 (0)