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

Fixed the diffusion profile becoming invalid when hitting the reset button (case 1269462). #2000

Merged
merged 3 commits into from
Sep 29, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -83,6 +83,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed SSGI compilation issues on PS4.
- Fixed "Screen position out of view frustum" error when camera is on exactly the planar reflection probe plane.
- Workaround issue that caused objects using eye shader to not be rendered on xbox.
- Fixed the usage of GUIEnable for volume components (case 1280018).
Copy link
Contributor

Choose a reason for hiding this comment

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

Leftover from another PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah seems like it

- Fixed the diffusion profile becoming invalid when hitting the reset (case 1269462).

### Changed
- Preparation pass for RTSSShadows to be supported by render graph.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using UnityEditor.Rendering.HighDefinition;

namespace UnityEngine.Rendering.HighDefinition
{
Expand Down Expand Up @@ -52,14 +53,19 @@ public enum TransmissionMode : uint

// Here we need to have one parameter in the diffusion profile parameter because the deserialization call the default constructor
public DiffusionProfile(bool dontUseDefaultConstructor)
{
ResetToDefault();
}

public void ResetToDefault()
{
scatteringDistance = Color.grey;
transmissionTint = Color.white;
texturingMode = TexturingMode.PreAndPostScatter;
transmissionMode = TransmissionMode.ThinObject;
thicknessRemap = new Vector2(0f, 5f);
worldScale = 1f;
ior = 1.4f; // Typical value for skin specular reflectance
transmissionTint = Color.white;
texturingMode = TexturingMode.PreAndPostScatter;
transmissionMode = TransmissionMode.ThinObject;
thicknessRemap = new Vector2(0f, 5f);
worldScale = 1f;
ior = 1.4f; // Typical value for skin specular reflectance
}

internal void Validate()
Expand Down Expand Up @@ -223,6 +229,15 @@ void OnEnable()
#endif
}

internal void Reset()
{
if (profile.hash == 0)
{
profile.ResetToDefault();
profile.hash = DiffusionProfileHashTable.GenerateUniqueHash(this);
}
}

internal void UpdateCache()
{
worldScaleAndFilterRadiusAndThicknessRemap = new Vector4(profile.worldScale,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ static uint GetDiffusionProfileHash(DiffusionProfileSettings asset)
return (exponent << 23) | mantissa;
}

static uint GenerateUniqueHash(DiffusionProfileSettings asset)
static internal uint GenerateUniqueHash(DiffusionProfileSettings asset)
{
uint hash = GetDiffusionProfileHash(asset);

Expand Down