Skip to content

Commit 4426bb1

Browse files
Fixed an issue where only one of the two lookdev views would update when changing the default lookdev volume profile. (#1529)
* Fixed an issue where only one of the two lookdev views would update when changing the default lookdev volume profile. * Update changelog
1 parent c888ee5 commit 4426bb1

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -781,6 +781,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
781781
- Fixed issues that lead to cookie atlas to be updated every frame even if cached data was valid.
782782
- Fixed an issue where world space UI was not emitted for reflection cameras in HDRP
783783
- Fixed an issue with cookie texture atlas that would cause realtime textures to always update in the atlas even when the content did not change.
784+
- Fixed an issue where only one of the two lookdev views would update when changing the default lookdev volume profile.
784785

785786
### Changed
786787
- Improve MIP selection for decals on Transparents

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,29 @@ namespace UnityEngine.Rendering.HighDefinition
55
{
66
public partial class HDRenderPipeline : IDataProvider
77
{
8-
#if UNITY_EDITOR
9-
int m_LookDevVolumeProfileHash = -1;
10-
#endif
11-
128
struct LookDevDataForHDRP
139
{
1410
public HDAdditionalCameraData additionalCameraData;
1511
public HDAdditionalLightData additionalLightData;
1612
public VisualEnvironment visualEnvironment;
1713
public HDRISky sky;
1814
public Volume volume;
15+
public int currentVolumeProfileHash;
1916
}
2017

2118
#if UNITY_EDITOR
22-
bool UpdateVolumeProfile(Volume volume, out VisualEnvironment visualEnvironment, out HDRISky sky)
19+
bool UpdateVolumeProfile(Volume volume, out VisualEnvironment visualEnvironment, out HDRISky sky, ref int volumeProfileHash)
2320
{
2421
HDRenderPipelineAsset hdrpAsset = GraphicsSettings.renderPipelineAsset as HDRenderPipelineAsset;
2522
if (hdrpAsset.defaultLookDevProfile == null)
2623
hdrpAsset.defaultLookDevProfile = hdrpAsset.renderPipelineEditorResources.lookDev.defaultLookDevVolumeProfile;
2724

2825
int newHashCode = hdrpAsset.defaultLookDevProfile.GetHashCode();
29-
if (newHashCode != m_LookDevVolumeProfileHash)
26+
if (newHashCode != volumeProfileHash)
3027
{
3128
VolumeProfile oldProfile = volume.sharedProfile;
3229

33-
m_LookDevVolumeProfileHash = newHashCode;
30+
volumeProfileHash = newHashCode;
3431

3532
VolumeProfile profile = ScriptableObject.Instantiate(hdrpAsset.defaultLookDevProfile);
3633
profile.hideFlags = HideFlags.HideAndDontSave;
@@ -118,16 +115,17 @@ void IDataProvider.FirstInitScene(StageRuntimeInterface SRI)
118115

119116
#if UNITY_EDITOR
120117
// Make sure we invalidate the current volume when first loading a scene.
121-
m_LookDevVolumeProfileHash = -1;
122-
UpdateVolumeProfile(volume, out var visualEnvironment, out var sky);
118+
int volumeProfileHash = -1;
119+
UpdateVolumeProfile(volume, out var visualEnvironment, out var sky, ref volumeProfileHash);
123120

124121
SRI.SRPData = new LookDevDataForHDRP()
125122
{
126123
additionalCameraData = additionalCameraData,
127124
additionalLightData = additionalLightData,
128125
visualEnvironment = visualEnvironment,
129126
sky = sky,
130-
volume = volume
127+
volume = volume,
128+
currentVolumeProfileHash = volumeProfileHash
131129
};
132130
#else
133131
//remove unassigned warnings when building
@@ -174,11 +172,13 @@ void IDataProvider.OnBeginRendering(StageRuntimeInterface SRI)
174172
{
175173
LookDevDataForHDRP data = (LookDevDataForHDRP)SRI.SRPData;
176174
#if UNITY_EDITOR
175+
int currentHash = data.currentVolumeProfileHash;
177176
// The default volume can change in the HDRP asset so if it does we need to re-instantiate it.
178-
if (UpdateVolumeProfile(data.volume, out var visualEnv, out var sky))
177+
if (UpdateVolumeProfile(data.volume, out var visualEnv, out var sky, ref currentHash))
179178
{
180179
data.sky = sky;
181180
data.visualEnvironment = visualEnv;
181+
data.currentVolumeProfileHash = currentHash;
182182
SRI.SRPData = data;
183183
}
184184
#endif

0 commit comments

Comments
 (0)