Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable Light Baking Cookies by default + Warning #79

Merged
merged 2 commits into from
Apr 17, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
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 @@ -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.
Expand Down
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, .";
skhiat marked this conversation as resolved.
Show resolved Hide resolved


// 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
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ internal static Volume GetOrCreateDefaultVolume()
readonly XRSystem m_XRSystem;

bool m_FrameSettingsHistoryEnabled = false;
bool m_DisableCookieForLightBaking = false;

/// <summary>
/// This functions allows the user to have an approximation of the number of rays that were traced for a given frame.
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -776,6 +780,8 @@ void UnsetRenderingFeatures()
// Reset srp batcher state just in case
GraphicsSettings.useScriptableRenderPipelineBatching = false;

UnityEditor.EditorSettings.disableCookiesInLightmapper = m_DisableCookieForLightBaking;

Lightmapping.ResetDelegate();
}

Expand Down