Conversion from FColor to FLinearColor

Looking at the conversion done in the constructor of FLinearColor taking an FColor I see the precomputed table sRGBToLinearTable is used. In the comment specifies the formula used:

Color > 0.04045 ? pow( Color * (1.0 / 1.055) + 0.0521327, 2.4 ) : Color * (1.0 / 12.92);

I made a quick calculation and see indeed to be using that version of the formula

BUT, Shouldnt this be though the correct formula?

Color > 0.04045 ? pow( (Color+0.0521327) * (1.0 / 1.055), 2.4 ) : Color * (1.0 / 12.92);

Thanks

Steps to Reproduce

Hi there,

Unreal’s formula is correct. The standard sRGB to linear conversion formula is:

[Image Removed]This is algebraically equivalent to Unreal’s formula:

[Image Removed]This formula pre-calculates the constant terms to save a tiny bit of computing power.

You have

[Image Removed]Which is not equivalent to the standard formula (the 0.0521327 value should be 0.055).

Regards,

Lance Chaney

Right! Sorry yeah I made a typo. On the second one I intended the constant in the sum to be 0.055 as you mention. What I didnt realize anyway is that 0.05213 is indeed 0.055 / 1.055. My bad

Thanks for the clarification!!