[Bf-committers] Updating Colour Configurations

Brecht Van Lommel brechtvanlommel at pandora.be
Mon Nov 9 02:17:01 CET 2015

On Sun, Nov 8, 2015 at 6:42 PM, Troy Sobotka <troy.sobotka at gmail.com> wrote:
> I have only peeked at the Cycles GPU path code, but it doesn't seem like
> there is a terrible level of chromaticity based hacks in place? I only saw
> the sRGB transfer curve hard coded? Perhaps there is a bit in the SSS code?
> (Being code that makes assumptions about the RGB primaries and rolls them
> through XYZ such as the hard-coded color temperature node.)

Cycles inputs and outputs are mostly scene linear colors and it
doesn't need to know much about that color space, but there are a
couple exceptions.

The simple changes would be in the wavelength, blackbody and sky
texture nodes, which make some assumptions about using Rec.709 scene
linear. An extra transformation between different scene linear spaces
should be enough to solve that. The Blender API just needs to expose
information about the scene linear color space so that Cycles can
construct those transformations, which I guess are just 3x3 matrices.

SSS requires no changes.

Mainly it's the image texture loading that's the difficult part, since
that goes through OIIO which doesn't know anything about Blender color
spaces, and its texture cache (as used by OSL) does not support doing
color space transformations on load. Right now it's basically built to
load textures that have already been converted to a .tx file in the
right scene linear color space, and are usually stored as half float.
Which is nice for film studios but not something we want to require
for Blender users.

So we either need to improve OIIO, implement our own texture cache. Or
make it so textures only go through the texture cache when they are
scene linear .tx files, and in other cases loaded them through Blender
APIs. The last option is probably the easiest, since loading any other
file formats gives poor texture cache performance anyway. Packed
images are already loaded this way so the code for that is more or
less there.

If the color space conversion is entirely done on the Blender side
then memory usage goes up though, because 8 bit is not enough to store
scene linear without major precision loss. So perhaps for the common
Rec.709 scene linear case you'd still store 8 bit, and for other cases
you just 16 bit half float.

More information about the Bf-committers mailing list