Enable Light Baking Cookies by default + Warning by skhiat · Pull Request #79 · Unity-Technologies/Graphics · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions com.unity.render-pipelines.high-definition/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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())
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down