Skip to content

[Backport 8.x.x] Fixed asset preview being rendered white because of static lighting sky. #478

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

Merged
merged 3 commits into from
May 14, 2020
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 @@ -21,6 +21,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Removed logic in the UI to disable parameters for contact shadows and fog volume components as it was going against the concept of the volume system.
- Fixed over consumption of GPU memory by the Physically Based Sky.
- Put more information in Camera background type tooltip and fixed inconsistent exposure behavior when changing bg type.
- Fixed an issue where asset preview could be rendered white because of static lighting sky.
- Fixed an issue where static lighting was not updated when removing the static lighting sky profile.

### Changed
- Shadowmask and realtime reflection probe property are hide in Quality settings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,13 @@ class SerializedStaticLightingSky
{
SerializedObject serializedObject;
public SerializedProperty skyUniqueID;

public VolumeProfile volumeProfile
{
get => (serializedObject.targetObject as StaticLightingSky).profile;
set => (serializedObject.targetObject as StaticLightingSky).profile = value;
}
public SerializedProperty profile;

public SerializedStaticLightingSky(StaticLightingSky staticLightingSky)
{
serializedObject = new SerializedObject(staticLightingSky);
skyUniqueID = serializedObject.FindProperty("m_StaticLightingSkyUniqueID");
profile = serializedObject.FindProperty("m_Profile");
}

public void Apply() => serializedObject.ApplyModifiedProperties();
Expand Down Expand Up @@ -174,10 +170,10 @@ void DrawGUI()
++EditorGUI.indentLevel;

//cannot use SerializeProperty due to logic in the property
var profile = m_SerializedActiveSceneLightingSky.volumeProfile;
var newProfile = EditorGUILayout.ObjectField(EditorGUIUtility.TrTextContent("Profile"), profile, typeof(VolumeProfile), allowSceneObjects: false) as VolumeProfile;
var profile = m_SerializedActiveSceneLightingSky.profile.objectReferenceValue;
var newProfile = EditorGUILayout.ObjectField(EditorGUIUtility.TrTextContent("Profile"), m_SerializedActiveSceneLightingSky.profile.objectReferenceValue, typeof(VolumeProfile), allowSceneObjects: false) as VolumeProfile;
if (profile != newProfile)
m_SerializedActiveSceneLightingSky.volumeProfile = newProfile;
m_SerializedActiveSceneLightingSky.profile.objectReferenceValue = newProfile;

using (new EditorGUI.DisabledScope(m_SkyClassNames.Count == 1)) // Only "None"
{
Expand All @@ -204,7 +200,7 @@ void UpdateSkyIntPopupData()
m_SkyClassNames.Add(new GUIContent("None"));
m_SkyUniqueIDs.Add(0);

VolumeProfile profile = m_SerializedActiveSceneLightingSky.volumeProfile;
VolumeProfile profile = m_SerializedActiveSceneLightingSky.profile.objectReferenceValue as VolumeProfile;
if (profile != null)
{
var skyTypesDict = SkyManager.skyTypesDict;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2006,7 +2006,6 @@ AOVRequestData aovRequest
m_PostProcessSystem.BeginFrame(cmd, hdCamera, this);

ApplyDebugDisplaySettings(hdCamera, cmd);
m_SkyManager.UpdateCurrentSkySettings(hdCamera);

SetupCameraProperties(hdCamera, renderContext, cmd);

Expand Down Expand Up @@ -2783,6 +2782,7 @@ ref HDCullingResults cullingResults
hdProbeCullState = HDProbeSystem.PrepareCull(camera);

// We need to set the ambient probe here because it's passed down to objects during the culling process.
skyManager.UpdateCurrentSkySettings(hdCamera);
skyManager.SetupAmbientProbe(hdCamera);

using (new ProfilingScope(null, ProfilingSampler.Get(HDProfileId.CullResultsCull)))
Expand Down