Skip to content

Commit cd9b18b

Browse files
committed
primaries wavelengths for aces colorspaces (not sure they're correct)
1 parent dee1b61 commit cd9b18b

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

include/nbl/builtin/hlsl/colorspace.hlsl

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,7 @@ namespace hlsl
1616
namespace colorspace
1717
{
1818

19-
struct colorspace_base
20-
{
21-
// default CIE RGB primaries wavelengths
22-
NBL_CONSTEXPR_STATIC_INLINE float32_t wavelength_R = 700.0f;
23-
NBL_CONSTEXPR_STATIC_INLINE float32_t wavelength_G = 546.1f;
24-
NBL_CONSTEXPR_STATIC_INLINE float32_t wavelength_B = 435.8f;
25-
};
26-
27-
struct scRGB : colorspace_base
19+
struct scRGB
2820
{
2921
NBL_CONSTEXPR_STATIC_INLINE float32_t wavelength_R = 611.4f;
3022
NBL_CONSTEXPR_STATIC_INLINE float32_t wavelength_G = 549.1f;
@@ -46,7 +38,7 @@ struct scRGB : colorspace_base
4638
struct sRGB : scRGB {};
4739
struct BT709 : scRGB {};
4840

49-
struct Display_P3 : colorspace_base
41+
struct Display_P3
5042
{
5143
NBL_CONSTEXPR_STATIC_INLINE float32_t wavelength_R = 614.9f;
5244
NBL_CONSTEXPR_STATIC_INLINE float32_t wavelength_G = 544.2f;
@@ -65,7 +57,7 @@ struct Display_P3 : colorspace_base
6557
static float32_t3 ToXYZ(float32_t3 val) { return hlsl::mul(Display_P3toXYZ, val); }
6658
};
6759

68-
struct DCI_P3 : colorspace_base
60+
struct DCI_P3
6961
{
7062
NBL_CONSTEXPR_STATIC_INLINE float32_t wavelength_R = 614.9f;
7163
NBL_CONSTEXPR_STATIC_INLINE float32_t wavelength_G = 544.2f;
@@ -84,7 +76,7 @@ struct DCI_P3 : colorspace_base
8476
static float32_t3 ToXYZ(float32_t3 val) { return hlsl::mul(DCI_P3toXYZ, val); }
8577
};
8678

87-
struct BT2020 : colorspace_base
79+
struct BT2020
8880
{
8981
NBL_CONSTEXPR_STATIC_INLINE float32_t wavelength_R = 630.0f;
9082
NBL_CONSTEXPR_STATIC_INLINE float32_t wavelength_G = 532.0f;
@@ -107,7 +99,7 @@ struct HDR10_ST2084 : BT2020 {};
10799
struct DOLBYIVISION : BT2020 {};
108100
struct HDR10_HLG : BT2020 {};
109101

110-
struct AdobeRGB : colorspace_base
102+
struct AdobeRGB
111103
{
112104
NBL_CONSTEXPR_STATIC_INLINE float32_t wavelength_R = 611.4f;
113105
NBL_CONSTEXPR_STATIC_INLINE float32_t wavelength_G = 534.7f;
@@ -126,8 +118,13 @@ struct AdobeRGB : colorspace_base
126118
static float32_t3 ToXYZ(float32_t3 val) { return hlsl::mul(AdobeRGBtoXYZ, val); }
127119
};
128120

129-
struct ACES2065_1 : colorspace_base
121+
struct ACES2065_1
130122
{
123+
// AP0 primaries (approximate)
124+
NBL_CONSTEXPR_STATIC_INLINE float32_t wavelength_R = 700.0f;
125+
NBL_CONSTEXPR_STATIC_INLINE float32_t wavelength_G = 520.0f;
126+
NBL_CONSTEXPR_STATIC_INLINE float32_t wavelength_B = 472.5f;
127+
131128
static float32_t3x3 FromXYZ()
132129
{
133130
return decode::XYZtoACES2065_1;
@@ -141,8 +138,13 @@ struct ACES2065_1 : colorspace_base
141138
static float32_t3 ToXYZ(float32_t3 val) { return hlsl::mul(ACES2065_1toXYZ, val); }
142139
};
143140

144-
struct ACEScc : colorspace_base
141+
struct ACEScc
145142
{
143+
// AP1 primaries (approximate)
144+
NBL_CONSTEXPR_STATIC_INLINE float32_t wavelength_R = 630.0f;
145+
NBL_CONSTEXPR_STATIC_INLINE float32_t wavelength_G = 533.0f;
146+
NBL_CONSTEXPR_STATIC_INLINE float32_t wavelength_B = 467.0f;
147+
146148
static float32_t3x3 FromXYZ()
147149
{
148150
return decode::XYZtoACEScc;

0 commit comments

Comments
 (0)