Skip to content

Commit f18b0c7

Browse files
Fix Luminance/EV conversion when LightMeterCalibrationConstant is changed (#6115)
1 parent 0827329 commit f18b0c7

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
4848
- Fixed issue with path traced shadows and layer masks (case 1375638).
4949
- Fixed Z axis orientation when sampling 3D textures in local volumetric fog.
5050
- Fixed geometry scale issue with the Eye Shader.
51+
- Fixed light unit conversion after changing mid gray value.
5152

5253
### Changed
5354
- Use RayTracingAccelerationStructure.CullInstances to filter Renderers and populate the acceleration structure with ray tracing instances for improved CPU performance on the main thread.

com.unity.render-pipelines.high-definition/Editor/Material/UIBlocks/EmissionUIBlock.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ namespace UnityEditor.Rendering.HighDefinition
1515
/// </summary>
1616
public class EmissionUIBlock : MaterialUIBlock
1717
{
18-
static float s_MaxEvValue = Mathf.Floor(LightUtils.ConvertLuminanceToEv(float.MaxValue)) - 1;
18+
// Max EV Value. Equals to LightUtils.ConvertLuminanceToEv(float.MaxValue)
19+
// Literal value to avoid precision issue with max float and to be independent of ColorUtils.s_LightMeterCalibrationConstant.
20+
static float s_MaxEvValue = 130.0f;
1921

2022
/// <summary>Options for emission block features. Use this to control which fields are visible.</summary>
2123
[Flags]

com.unity.render-pipelines.high-definition/Runtime/Lighting/LightUtils.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ namespace UnityEngine.Rendering.HighDefinition
88
/// </summary>
99
class LightUtils
1010
{
11-
static float s_LuminanceToEvFactor = Mathf.Log(100f / ColorUtils.s_LightMeterCalibrationConstant, 2);
12-
static float s_EvToLuminanceFactor = -Mathf.Log(100f / ColorUtils.s_LightMeterCalibrationConstant, 2);
11+
static float s_LuminanceToEvFactor => Mathf.Log(100f / ColorUtils.s_LightMeterCalibrationConstant, 2);
12+
static float s_EvToLuminanceFactor => -Mathf.Log(100f / ColorUtils.s_LightMeterCalibrationConstant, 2);
1313

1414
// Physical light unit helper
1515
// All light unit are in lumen (Luminous power)

0 commit comments

Comments
 (0)