Fixed the diffusion profile becoming invalid when hitting the reset button (case 1269462). by anisunity · Pull Request #2000 · Unity-Technologies/Graphics · GitHub
Skip to content
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
1 change: 1 addition & 0 deletions com.unity.render-pipelines.high-definition/CHANGELOG.md
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