Skip to content
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
1 change: 1 addition & 0 deletions com.unity.render-pipelines.core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed ACES tonemaping for Nintendo Switch by forcing some shader color conversion functions to full float precision.
- Fixed missing warning UI about Projector component being unsupported (case 1300327).
- Fixed the display name of a Volume Parameter when is defined the attribute InspectorName
- Fixed ACES tonemaping for Nintendo Switch by forcing some shader color conversion functions to full float precision.
- Fix crash on VolumeComponentWithQualityEditor when the current Pipeline is not HDRP

## [10.2.0] - 2020-10-19
Expand Down
16 changes: 16 additions & 0 deletions com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,11 @@ real YCoCgCheckBoardEdgeFilter(real centerLum, real2 a0, real2 a1, real2 a2, rea
}

// Converts linear RGB to LMS
#if defined(SHADER_API_SWITCH) // Must use full float precision on Switch to avoid artefact when using ACES tonemapping
float3 LinearToLMS(float3 x)
#else
real3 LinearToLMS(real3 x)
#endif
Copy link
Contributor

Choose a reason for hiding this comment

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

Imo if this function needs full precision it should be changed for all platforms, otherwise we have the same issue on mobile. Checking the original PR, @eh-unity made the same comment.

Copy link
Contributor Author

@kaychang-unity kaychang-unity Mar 5, 2021

Choose a reason for hiding this comment

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

I tested on iPhone8 metal and Galaxy S9 Mali-G72 Vulkan but could not reproduce the issue, hence why it is conservatively kept Switch only. But I can enable it for all platforms if you prefer. There is similar floating point fix in AcesTonemap() and NeutralCurve() for Switch but done from a different PR, do you want to change them for all platforms too?

{
const real3x3 LIN_2_LMS_MAT = {
3.90405e-1, 5.49941e-1, 8.92632e-3,
Expand All @@ -265,7 +269,11 @@ real3 LinearToLMS(real3 x)
return mul(LIN_2_LMS_MAT, x);
}

#if defined(SHADER_API_SWITCH) // Must use full float precision on Switch to avoid artefact when using ACES tonemapping
float3 LMSToLinear(float3 x)
#else
real3 LMSToLinear(real3 x)
#endif
{
const real3x3 LMS_2_LIN_MAT = {
2.85847e+0, -1.62879e+0, -2.48910e-2,
Expand Down Expand Up @@ -395,7 +403,11 @@ real LinearToLogC_Precise(real x)
return o;
}

#if defined(SHADER_API_SWITCH) // Must use full float precision on Switch to avoid artefact when using ACES tonemapping
float3 LinearToLogC(float3 x)
#else
real3 LinearToLogC(real3 x)
#endif
{
#if USE_PRECISE_LOGC
return real3(
Expand All @@ -408,7 +420,11 @@ real3 LinearToLogC(real3 x)
#endif
}

#if defined(SHADER_API_SWITCH) // Must use full float precision on Switch to avoid artefact when using ACES tonemapping
float3 LogCToLinear(float3 x)
#else
real LogCToLinear_Precise(real x)
#endif
{
real o;
if (x > LogC.e * LogC.cut + LogC.f)
Expand Down