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

Fix color curves changes not applying immediately in editor #6322

Merged
merged 4 commits into from
Nov 26, 2021
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
13 changes: 13 additions & 0 deletions com.unity.render-pipelines.core/Runtime/Volume/VolumeComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,19 @@ public override int GetHashCode()
}
}

/// <summary>
/// Returns true if any of the volume properites has been overridden.
/// </summary>
/// <returns>True if any of the volume properites has been overridden.</returns>
public bool AnyPropertiesIsOverridden()
{
for (int i = 0; i < parameters.Count; ++i)
{
if (parameters[i].overrideState) return true;
}
return false;
}

/// <summary>
/// Unity calls this method before the object is destroyed.
/// </summary>
Expand Down
1 change: 1 addition & 0 deletions com.unity.render-pipelines.high-definition/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed camera bridge action in release build (case 1367866).
- Fixed contact shadow disappearing when shadowmask is used and no non-static object is available.
- Fixed atmospheric scattering being incorrectly enabled when scene lighting is disabled.
- Fixed for changes of color curves not being applied immediately.

### Changed
- Optimizations for the physically based depth of field.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4306,7 +4306,8 @@ TextureHandle ColorGradingPass(RenderGraph renderGraph)
var currentGradingHash = ComputeLUTHash();

// The lut we have already is ok.
if (currentGradingHash == m_LutHash)
if (currentGradingHash == m_LutHash &&
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this mean that we recompute the LUT every frame whenever any parameter of the curve is overridden? I suppose this can actually happen quite often :/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, but the LUT is cheaper to compute than the hash (and up until really recently it was computed every frame anyhow :P )

!m_Curves.AnyPropertiesIsOverridden()) // Curves content are not hashed, to compute the hash of the curves would probably be more expensive than actually running the LUT pass. So we just check if the project is using anything but the default
return logLut;

// Else we update the hash and we recompute the LUT.
Expand Down