Hello,
Decided to give Ray trace in a weekend a go, my Color class has a fast srgb method i picked up from nvidia.
inline float ToSrgbFast(float f)
{
//Close Approximation to SRGB
f = Mathf::Clamp01(f);
float s1 = Mathf::Sqrt(f);
float s2 = Mathf::Sqrt(s1);
float s3 = Mathf::Sqrt(s2);
return 0.662002687 * s1 + 0.684122060 * s2 - 0.323583601 * s3 - 0.0225411470 * f;
}
Problem is, it is innacurate for small values giving a result such as:
Notice close to black values are innacurate.
if i use a standard reciprical approximation i get:
Also here is an article about how the fast method was derived: Fast SRGB Approximation
Does anyone know what the issue might be?
Thanks.