Gamma Correction of OIIO

apiitem{"oiio:ColorSpace" : string}
  The name of the color space of the color channels. Values incude:
  qkw{Linear}, qkw{sRGB}, qkw{GammaCorrected}, qkw{AdobeRGB},
  qkw{Rec709}, and qkw{KodakLog}.
  apiend
   
  apiitem{"oiio:Gamma" : float}
  If the color space is qkw{GammaCorrected}, this value is the gamma
  exponent.
  apiend
The {cf ImageSpec::extra_attribs} field may store metadata that reveals
  the color space the image file in the qkw{oiio:ColorSpace}
  attribute, which may take on any of the following values:
   
  egin{description}
  item[halfspc m qkw{Linear}] indicates that the
  color pixel values are known to be linear.
  item[halfspc m qkw{GammaCorrected}] indicates
  that the color pixel values (but not alpha or $z$) have
  already been gamma corrected (raised to the power $1/gamma$), and
  that the gamma exponent may be found in the qkw{oiio:Gamma} metadata.
  item[halfspc m qkw{sRGB}] indicates that the
  color pixel values are in sRGB color space.
  item[halfspc m qkw{AdobeRGB}] indicates that the
  color pixel values are in Adobe RGB color space.
  item[halfspc m qkw{Rec709}] indicates that the
  color pixel values are in Rec709 color space.
  item[halfspc m qkw{KodakLog}] indicates that the
  color pixel values are in Kodak logarithmic color space.
  end{description}
   
  The ImageInput sets the qkw{oiio:ColorSpace} metadata in a
  purely advisory capacity --- the {cf read} will not convert pixel
  values among color spaces. Many image file formats only support
  nonlinear color spaces (for example, JPEG/JFIF dictates use of sRGB).
  So your application should intelligently deal with gamma-corrected and
  sRGB input, at the very least.
   
  The color space hints only describe color channels. You should assume that
  alpha or depth ($z$) channels (designated by the {cf alpha_channel} and
  {cf z_channel} fields, respectively) always represent linear values and
  should never be transformed by your application.

spec.attribute("oiio::ColorSpace", "Linear");

spec.attribute("oiio::ColorSpace", "GammaCorrected");
spec.attribute("oiio::Gamma", (float)gamma);

spec.attribute("oiio::ColorSpace", "sRGB");
spec.attribute("oiio::ColorSpace", "Rec709");

----------------------------------------------------------------------------------------------------------

Applies an inverse gamma correction to texture lookups. For example, a value of 2.2 will linearize a texture that comes in with a gamma of 2.2. This is done for 8 and 16 bit images.

Arnold scans the contents of a texture (it does not rely on the extension) and anything that is not float is considered to have a gamma baked even if the image has a different color space embedded.

Tx texture format

You can convert your textures to linear space with the make tx tool. This way you can ensure that all of your textures are linear before rendering. For example:

maketx --colorconvert sRGB linear C:solidanglemtoadeploy2014inimage.jpg
原文地址:https://www.cnblogs.com/len3d/p/4324746.html