Linear to sRGB

Putting this here for reference, I had this written down as a function to convert from linear light into srgb.

// encode from linear light to sRGB luma
float sRGB_encode_f(float F)
{
	float lin;
	if(F <= 0.00304)
		lin = F*12.92;
	else
		lin = (1.055 * pow(F, (1.0/2.4)) - 0.055);
	return lin;
}

Leave a Reply

Your email address will not be published. Required fields are marked *