[Bf-codereview] Gamma Node for Cycles (issue 5488046)
dfelinto at gmail.com
dfelinto at gmail.com
Sun Dec 18 21:00:59 CET 2011
Brecht, is this to approximate the result from a real gamma curve?
On 2011/12/18 12:17:50, brechtvl wrote:
> Gamma 2.2 and 1.0/2.2 should cancel each other out. However, Blender
sRGB <=>
> linear conversion is not a simple gamma conversion, the formula for
that is
> quite different:
> float srgb_to_linearrgb(float c)
> {
> if (c < 0.04045f)
> return (c < 0.0f)? 0.0f: c * (1.0f/12.92f);
> else
> return powf((c + 0.055f)*(1.0f/1.055f), 2.4f);
> }
> float linearrgb_to_srgb(float c)
> {
> if (c < 0.0031308f)
> return (c < 0.0f)? 0.0f: c * 12.92f;
> else
> return 1.055f * powf(c, 1.0f/2.4f) - 0.055f;
> }
http://codereview.appspot.com/5488046/
More information about the Bf-codereview
mailing list