Hi guys,
currently I am struggling with the HDR Output of Unity, especially changing the PaperWhiteNits value by code.
This is my current test code. For safety reasons, I loop through each display.
using UnityEngine;
public class SetHDRPaperWhite : MonoBehaviour
{
[SerializeField] [Range(0, 400)] private float paperWhiteNits;
void Awake()
{
SetHDR();
}
void SetHDR()
{
Debug.LogWarning("Calling SetHDR()!");
foreach (var hdrOutput in HDROutputSettings.displays)
{
if (!hdrOutput.available)
continue;
Debug.LogWarning("HDR available, adjusting paperWhiteValue");
Debug.LogWarning($"Current PaperWhiteNits Value: {hdrOutput.paperWhiteNits}");
hdrOutput.automaticHDRTonemapping = true;
hdrOutput.paperWhiteNits = paperWhiteNits;
Debug.LogWarning($"After Modification PaperWhiteNits Value: {hdrOutput.paperWhiteNits}");
}
}
}
Using this snippet, regarding to the log, it works. Values are changing and that's it. But visually, there is no difference.
Doing the 'same' by manipulating volume overrides, it behaves as it should.
So my question is ... how do I manipulate it, so it is applied to the display?
Thanks for your help 🙂