I have added the support for color spaces to LuxCoreRender v2.6 branch. LuxCore internally works in a linear FP32 color space and any input/output color needs to be converted to/from that color space. There are currently 3 supported input/output color spaces: Nop, LuxCore and OpenColorIO.
Nop color space
This is the internal LuxCore linear FP32 color space so it is effectively a nop conversion (i.e. the color is not modified).
LuxCore color space
This is just a gamma corrected color space so all inputs are reversed gamma corrected and all output are gamma corrected.
OpenColorIO color space
OpenColorIO (https://opencolorio.org) color space supports a wide configurable range of color spaces, including industrial standards like: ACES (https://acescolorspace.com), Filmic (https://sobotka.github.io/filmic-blender), Sony Anim/VFX (https://github.com/imageworks/OpenColorIO-Configs), etc..
What is the problem ?
There was a major problem in LuxCore before the introduction of color spaces: LuxCore applies reverse gamma correction to input images (texture maps, etc.) but not to input colors. This means the color you pick on the screen was not the color you get as output (i.e. it is like if it was gamma corrected 2 times). The difference can be really huge. This is the main reason why you should start to use color spaces even if compatibility with the past is fully maintained.
Compatibility
By default, LuxCore still work exactly as now. All the new color spaces related features are available as an extension and are not breaking the compatibility with the past.
Outputs conversion
New OpenColorIO tone mapper
The first tool to enable the use of color spaces is the new TONEMAP_OPENCOLORIO. It converts the rendering output using OpenColorIO. It supporte 3 working modes:
1) Color space conversion, for instance, this converts from Sony "lnf" color space (LuxCore linear FP32 color space, aka Nop color space) to Sony "vd8" (Sony video 8bit color space):
Code: Select all
# From linear FP32 color space to video display 8 bit colorspace
film.imagepipelines.0.0.type = TONEMAP_OPENCOLORIO
film.imagepipelines.0.0.mode = COLORSPACE_CONVERSION
# Use system default OpenColorIO configuration
film.imagepipelines.0.0.config = ""
film.imagepipelines.0.0.src = lnf
film.imagepipelines.0.0.dst = vd8
Code: Select all
# Using a display mode
film.imagepipelines.0.0.type = TONEMAP_OPENCOLORIO
film.imagepipelines.0.0.mode = DISPLAY_CONVERSION
# Use Sony Anim OpenColorIO configuration
film.imagepipelines.0.0.config = "deps/opencolorio-configs/spi-anim/config.ocio"
film.imagepipelines.0.0.src = lnf
film.imagepipelines.0.0.display = sRGB
film.imagepipelines.0.0.view = Film
Code: Select all
# Using a custom LUT mode
film.imagepipelines.0.0.type = TONEMAP_OPENCOLORIO
film.imagepipelines.0.0.mode = LUT_CONVERSION
film.imagepipelines.0.0.lutfile = deps/opencolorio-configs/spi-anim/luts/lmf.spi1d
Inputs conversion
Image maps color space support
It is now possible to declare the color space of an image map (used for texture mapping, infinite lights, etc.) in order to have the appropriate conversion to internal LuxCore rnedering color space. For instance, Nop color space:
Code: Select all
scene.textures.imgtex.file = scenes/randomizedtiling/pattern-3.jpg
scene.textures.imgtex.colorspace = nop
Code: Select all
scene.textures.imgtex.file = scenes/randomizedtiling/pattern-3.jpg
scene.textures.imgtex.colorspace = luxcore
scene.textures.imgtex.colorspace.gamma = 2.2
Code: Select all
scene.textures.imgtex.file = scenes/randomizedtiling/pattern-3.jpg
scene.textures.imgtex.colorspace = opencolorio
# Use system default OpenColorIO configuration
scene.textures.imgtex.colorspace.config = ""
scene.textures.imgtex.colorspace.name = vd8
It is now possible to declare the color space of a constant color (float and float3), for instance:
Code: Select all
scene.textures.KhakiCol.type = constfloat3
scene.textures.KhakiCol.value = 1. 0.824176 0.549451
scene.textures.KhakiCol.colorspace = luxcore
scene.textures.KhakiCol.colorspace.gamma = 2.2
##
scene.textures.DarkGreenCol.type = constfloat3
scene.textures.DarkGreenCol.value = 0. 0.4 0.
scene.textures.DarkGreenCol.colorspace = opencolorio
# Use system default OpenColorIO configuration
scene.textures.DarkGreenCol.colorspace.config = ""
scene.textures.DarkGreenCol.colorspace.name = vd8
LuxCore supports a more compact and inlined definition of constant colors. This syntax has been extended too:
Code: Select all
# Old syntax
scene.materials.HalveRed.type = matte
scene.materials.HalveRed.kd = 0.70003 0. 0.
Code: Select all
scene.materials.HalveRed.type = matte
scene.materials.HalveRed.kd = nop 0.70003 0. 0.
Code: Select all
scene.materials.HalveRed.type = matte
scene.materials.HalveRed.kd = luxcore 2.2 0.70003 0. 0.
Code: Select all
scene.materials.HalveRed.type = matte
scene.materials.HalveRed.kd = opencolorio "" vd8 0.70003 0. 0.
The same syntax of implicit definitions of constant float and float3 can be used in all properties of material and light sources. This pretty much cover all possible inputs.
Blender integration
How to integrated this feature in Blender is something still to be defined and it depends in how Blender supports and works with color spaces. The general rule should be to have the possibility to pick a color space every time you select a color or an image. The same for the outputs. Adding this feature may require few iterations.