Skip to content

Fixed asset preview being rendered white because of static lighting sky. #462

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 @@ -600,6 +600,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed an invalid rotation in Planar Reflection Probe editor display, that was causing an error message (case 1182022)
- Put more information in Camera background type tooltip and fixed inconsistent exposure behavior when changing bg type.
- Fixed issue that caused not all baked reflection to be deleted upon clicking "Clear Baked Data" in the lighting menu (case 1136080)
- 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
- Improve MIP selection for decals on Transparents
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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ouch Thanks for fixing this too. Previous version was not multi-editable


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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could be simplified as profile is stored right above

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 @@ -2077,7 +2077,6 @@ AOVRequestData aovRequest
m_PostProcessSystem.BeginFrame(cmd, hdCamera, this);

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

SetupCameraProperties(hdCamera, renderContext, cmd);

Expand Down Expand Up @@ -2923,6 +2922,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 Expand Up @@ -4981,7 +4981,7 @@ public OverrideCameraRendering(CommandBuffer cmd, Camera overrideCamera)
// Mark the HDCamera as persistant so it's not deleted because it's camera is disabled.
overrideHDCamera.isPersistent = true;

// We need to patch the pixel rect of the camera because by default the camera size is synchronized
// We need to patch the pixel rect of the camera because by default the camera size is synchronized
// with the game view and so it breaks in the scene view. Note that we can't use Camera.pixelRect here
// because when we assign it, the change is not instantaneous and is not reflected in pixelWidth/pixelHeight.
overrideHDCamera.OverridePixelRect(hdrp.m_CurrentHDCamera.camera.pixelRect);
Expand Down Expand Up @@ -5011,7 +5011,7 @@ bool IsContextValid(Camera overrideCamera)

if (overrideCamera == hdrp.m_CurrentHDCamera.camera)
return false;

return true;
}

Expand Down