Skip to content

Commit eec0506

Browse files
[Backport 7.x.x] Fixed asset preview being rendered white because of static lighting sky. (#479)
* Fixed an issue where asset preview could be rendered white because of static lighting sky. Also fixed an issue where static lighting was not updated when removing the static lighting sky profile. # Conflicts: # com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs * Update changelog
1 parent 762012c commit eec0506

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
7171
- 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.
7272
- Fixed over consumption of GPU memory by the Physically Based Sky.
7373
- Put more information in Camera background type tooltip and fixed inconsistent exposure behavior when changing bg type.
74+
- Fixed an issue where asset preview could be rendered white because of static lighting sky.
75+
- Fixed an issue where static lighting was not updated when removing the static lighting sky profile.
7476

7577
### Changed
7678
- Rejecting history for ray traced reflections based on a threshold evaluated on the neighborhood of the sampled history.

com.unity.render-pipelines.high-definition/Editor/Sky/HDLightingWindowEnvironmentSection.cs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,13 @@ class SerializedStaticLightingSky
3232
{
3333
SerializedObject serializedObject;
3434
public SerializedProperty skyUniqueID;
35-
36-
public VolumeProfile volumeProfile
37-
{
38-
get => (serializedObject.targetObject as StaticLightingSky).profile;
39-
set => (serializedObject.targetObject as StaticLightingSky).profile = value;
40-
}
35+
public SerializedProperty profile;
4136

4237
public SerializedStaticLightingSky(StaticLightingSky staticLightingSky)
4338
{
4439
serializedObject = new SerializedObject(staticLightingSky);
4540
skyUniqueID = serializedObject.FindProperty("m_StaticLightingSkyUniqueID");
41+
profile = serializedObject.FindProperty("m_Profile");
4642
}
4743

4844
public void Apply() => serializedObject.ApplyModifiedProperties();
@@ -174,10 +170,10 @@ void DrawGUI()
174170
++EditorGUI.indentLevel;
175171

176172
//cannot use SerializeProperty due to logic in the property
177-
var profile = m_SerializedActiveSceneLightingSky.volumeProfile;
178-
var newProfile = EditorGUILayout.ObjectField(EditorGUIUtility.TrTextContent("Profile"), profile, typeof(VolumeProfile), allowSceneObjects: false) as VolumeProfile;
173+
var profile = m_SerializedActiveSceneLightingSky.profile.objectReferenceValue;
174+
var newProfile = EditorGUILayout.ObjectField(EditorGUIUtility.TrTextContent("Profile"), m_SerializedActiveSceneLightingSky.profile.objectReferenceValue, typeof(VolumeProfile), allowSceneObjects: false) as VolumeProfile;
179175
if (profile != newProfile)
180-
m_SerializedActiveSceneLightingSky.volumeProfile = newProfile;
176+
m_SerializedActiveSceneLightingSky.profile.objectReferenceValue = newProfile;
181177

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

207-
VolumeProfile profile = m_SerializedActiveSceneLightingSky.volumeProfile;
203+
VolumeProfile profile = m_SerializedActiveSceneLightingSky.profile.objectReferenceValue as VolumeProfile;
208204
if (profile != null)
209205
{
210206
var skyTypesDict = SkyManager.skyTypesDict;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1975,7 +1975,6 @@ AOVRequestData aovRequest
19751975
m_PostProcessSystem.BeginFrame(cmd, hdCamera, this);
19761976

19771977
ApplyDebugDisplaySettings(hdCamera, cmd);
1978-
m_SkyManager.UpdateCurrentSkySettings(hdCamera);
19791978

19801979
SetupCameraProperties(hdCamera, renderContext, cmd);
19811980

@@ -2755,6 +2754,7 @@ ref HDCullingResults cullingResults
27552754
hdProbeCullState = HDProbeSystem.PrepareCull(camera);
27562755

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

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

0 commit comments

Comments
 (0)