Color spaces support (aka OpenColorIO v2.0)

Discussion related to the LuxCore functionality, implementations and API.
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: Color spaces support (aka OpenColorIO v2.0)

Post by Dade »

SiddhantRane wrote: Sun Oct 24, 2021 3:33 am
Dade wrote: Sat Oct 23, 2021 4:32 pm
There is only one type of linear FP32: it is meaning depends how you transform the input colors and output colors (so LuxCore internal color representation can be sRGB or ACEScg).
Here's what I'm confused about: When you say 'Linear FP32', you're only talking about the gamma and bit depth of Nop which I'm assuming is the rendering (working) color space of LuxCore, like sRGB Linear FP32 in Blender Cycles.
What I don't understand is this: because you say Nop can be represented as ACEScg or sRGB, then what color primaries does Nop use? Is it using ACES AP0/AP1 primaries or have you developed a new wide golor gamut for LuxCore?
Also by "represented", do you mean Nop can be transformed to ACEScg using OCIO RRT/ODT; or can LuxCore have the ability to render in the full ACEScg gamut via Nop?
"Nop" is just 3 x 32bit floating point values, their meaning is completely determined by how you transform the inputs and the outputs. You can render visible spectrum, infra-red, ultra-violet, sound waves, sRGB, XYZ, pink elephants or whatever. As long as you don't have wave length dependent interactions, the result is correct.
Its interpretation is entirely dependent on the meaning assigned to inputs and the outputs: "garbage in, garbage out", "pink elephants in, pink elephants out", "sRGB in, sRGB out", etc.
Support LuxCoreRender project with salts and bounties
User avatar
TAO
Developer
Developer
Posts: 850
Joined: Sun Mar 24, 2019 4:49 pm
Location: France
Contact:

Re: Color spaces support (aka OpenColorIO v2.0)

Post by TAO »

One question is there OCIO config files are embed in luxcore render or should be copied separately?
User avatar
Dade
Developer
Developer
Posts: 5672
Joined: Mon Dec 04, 2017 8:36 pm
Location: Italy

Re: Color spaces support (aka OpenColorIO v2.0)

Post by Dade »

TAO wrote: Fri Feb 04, 2022 6:08 pm One question is there OCIO config files are embed in luxcore render or should be copied separately?
They are external (text) files.
Support LuxCoreRender project with salts and bounties
User avatar
TAO
Developer
Developer
Posts: 850
Joined: Sun Mar 24, 2019 4:49 pm
Location: France
Contact:

Re: Color spaces support (aka OpenColorIO v2.0)

Post by TAO »

Dade wrote: Fri Feb 04, 2022 7:45 pm
TAO wrote: Fri Feb 04, 2022 6:08 pm One question is there OCIO config files are embed in luxcore render or should be copied separately?
They are external (text) files.
So I need to add Ocio/Aces manually in the blender and then I will be able to use it in luxcore by reading the data or Is just a single config.ocio file is enough because I already have all the Aces and OpenIO libraries available on my machine.
Because last night I start to add Ocio in the blender and I am still a little bit fuzzy here because I'm not a blender user. sorry if my questions are dumb.
Screenshot 2022-02-12 151159.jpg
Screenshot 2022-02-12 151237.jpg
Screenshot 2022-02-12 151142.jpg
By adding Aces to the blender all these options will be added to the blender and I can read them simply and purse them to luxcore. but I'm not sure if that's the correct way to and if I should add Aces/Ocio config to blender like this.
User avatar
Sharlybg
Donor
Donor
Posts: 3101
Joined: Mon Dec 04, 2017 10:11 pm
Location: Ivory Coast

Re: Color spaces support (aka OpenColorIO v2.0)

Post by Sharlybg »

It look exactly like what they did for blender 3.0
And Cyclesx so should be ok I think.
Great job.
Support LuxCoreRender project with salts and bounties

Portfolio : https://www.behance.net/DRAVIA
bartek_zgo
Posts: 116
Joined: Mon Oct 26, 2020 11:42 am

Re: Color spaces support (aka OpenColorIO v2.0)

Post by bartek_zgo »

Hi Guys,
I'm trying to add ACES to my pipeline. But there is one thing I don't know how to set. Luxcore internal color spaces is FP32. As I understand I have to use some color space that is supported by ACES config. I take a look inside config and I can not find anything like lnf or linear. So what should I use as source color space?
film.imagepipelines.0.3.src = "lnf" ????????????????????
Should I first convert lnf to something else supported by ACES?
Or maybe I should import all textures using OCIO and convert them to ACES color space, and make Luxcore work with ACES?

Code: Select all

film.imagepipelines.0.0.type = "NOP"
film.imagepipelines.0.1.type = "INTEL_OIDN"
film.imagepipelines.0.1.prefilter.enable = "1"
film.imagepipelines.0.2.type = "TONEMAP_LUXLINEAR"
film.imagepipelines.0.2.sensitivity = "100"
film.imagepipelines.0.2.exposure = 0.0025
film.imagepipelines.0.2.fstop = 4
film.imagepipelines.0.3.type = "TONEMAP_OPENCOLORIO"
film.imagepipelines.0.3.mode = "DISPLAY_CONVERSION"
film.imagepipelines.0.3.config = "/mnt/z/MATADOR/Plugins/OpenColorIO-Config-ACES-1.2/aces_1.2/config.ocio"
film.imagepipelines.0.3.src = "lnf" ????????????????????
film.imagepipelines.0.3.display = "ACES"
film.imagepipelines.0.3.view = "sRGB"

sarmath
Posts: 135
Joined: Wed Feb 07, 2018 1:22 pm

Re: Color spaces support (aka OpenColorIO v2.0)

Post by sarmath »

Hi

Here is a tutorial how to use ACEScg easy way in Blender 3.2 and Cycles, but I have done this with Luxcore as well.
Its based on compositor and new Convert Color Space node. Hope it helps.

https://youtu.be/Ir9jk2LuC3I
WIndows 11 Pro Ryzen 7 5700x RTX 3090 32 GB RAM
bartek_zgo
Posts: 116
Joined: Mon Oct 26, 2020 11:42 am

Re: Color spaces support (aka OpenColorIO v2.0)

Post by bartek_zgo »

Hi guys. We have make working ACES with Luxcore, so I want to summarize what we have discovered. Maybe it will be helpful for someone.
So we want to make Luxcore work in ACEScg color space. All input color data have to be converted to ACEScg, and than the output has to be converted back to sRGB or some other color space that we like.

Most of the textures that you have (png, jpg, tiff etc) are saved in sRGB color spaces. So you have to convert them from sRGB to ACEScg. For that we use transformation celled: Utility - sRGB - Texture

Code: Select all

scene.textures._61_basecolor.type = "imagemap"
scene.textures._61_basecolor.file = "/mnt/nodeHDD1/cache/Texture/576/17264.jpg"
scene.textures._61_basecolor.mapping.type = "uvmapping2d"
scene.textures._61_basecolor.mapping.rotation = 0
scene.textures._61_basecolor.gamma = 1 //I think this is irrelevant
scene.textures._61_basecolor.mapping.uvscale = 1 1
scene.textures._61_basecolor.colorspace = "opencolorio"
scene.textures._61_basecolor.colorspace.config = "your_path_to_aces/OpenColorIO-Config-ACES-1.2/aces_1.2/config.ocio"
scene.textures._61_basecolor.colorspace.name = "Utility - sRGB - Texture"
If you want a pure color, remember to convert it too:

Code: Select all

scene.materials.79121_100.basecolor = "opencolorio" "your_path_to_aces/OpenColorIO-Config-ACES-1.2/aces_1.2/config.ocio" "Utility - sRGB - Texture" 0.8588235 0.8588235 0.8588235
When you want to import some texture that is not used as color texture but as normalmap, bump etc, we don't want to convert it, as it contains numerical data rather then color. So we have to use Utility - RAW transformation:

Code: Select all

scene.textures._61_bump01_texture1.type = "imagemap"
scene.textures._61_bump01_texture1.file = "/mnt/nodeHDD1/cache/Texture/576/17264.jpg"
scene.textures._61_bump01_texture1.mapping.type = "uvmapping2d"
scene.textures._61_bump01_texture1.mapping.rotation = 0
scene.textures._61_bump01_texture1.gamma = 1
scene.textures._61_bump01_texture1.mapping.uvscale = 1 1
scene.textures._61_bump01_texture1.colorspace = "opencolorio"
scene.textures._61_bump01_texture1.colorspace.config = "your_path_to_aces/OpenColorIO-Config-ACES-1.2/aces_1.2/config.ocio"
scene.textures._61_bump01_texture1.colorspace.name = "Utility - Raw"
At the end we want to output our render so we have to convert it back from ACEScg to sRGB (or other if you want). In case of png or jpg:

Code: Select all

film.imagepipelines.0.0.type = "NOP"
film.imagepipelines.0.1.type = "NOP"
film.imagepipelines.0.2.type = "TONEMAP_LUXLINEAR"
film.imagepipelines.0.2.sensitivity = "100"
film.imagepipelines.0.2.exposure = 0.0025
film.imagepipelines.0.2.fstop = 4
film.imagepipelines.0.8.type = "TONEMAP_OPENCOLORIO"
film.imagepipelines.0.8.mode = "DISPLAY_CONVERSION"
film.imagepipelines.0.8.config = "your_path_to_aces\OpenColorIO-Config-ACES-1.2\aces_1.2\config.ocio"
film.imagepipelines.0.8.src = "ACEScg"
film.imagepipelines.0.8.display = "ACES"
film.imagepipelines.0.8.view = "sRGB"
film.outputs.0.type = "RGB_IMAGEPIPELINE"
film.outputs.0.filename = "out.png"
film.outputs.0.index = 0
It is much more complicated when you want to output exr. The problem with exr is, that it contains linear color space, so to be visualized you have to apply some transformation. If you open exr with Phothshop it applies his own transformation. So you have two possibilities. First solution is to save simply RAW ACEScg and than import ACES ocio file to PS and tell PS to apply correct color space when opening file.
Second solution is to convert ACEScg linear color space to classic linear color space. In this solution (that is better in my case) user does not have to modify anything in PS. To obtain this, you have to apply two transformations. I have found this thanks to this viedeo: https://www.youtube.com/watch?v=dksSrFWxLr4 (watch whole video as he is showing 2 possibilities and the second one is helpful)

Code: Select all

film.imagepipelines.1.0.type = "NOP"
film.imagepipelines.1.1.type = "NOP"
film.imagepipelines.1.2.type = "TONEMAP_LUXLINEAR"
film.imagepipelines.1.2.sensitivity = "100"
film.imagepipelines.1.2.exposure = 0.0025
film.imagepipelines.1.2.fstop = 4
film.imagepipelines.1.3.type = "TONEMAP_OPENCOLORIO"
film.imagepipelines.1.3.mode = "COLORSPACE_CONVERSION"
film.imagepipelines.1.3.config = "your_path_to_aces\OpenColorIO-Config-ACES-1.2\aces_1.2\config.ocio"
film.imagepipelines.1.3.src = "ACEScg"
film.imagepipelines.1.3.dst = "Output - sRGB"
film.imagepipelines.1.4.type = "TONEMAP_OPENCOLORIO"
film.imagepipelines.1.4.mode = "COLORSPACE_CONVERSION"
film.imagepipelines.1.4.config = "your_path_to_aces\OpenColorIO-Config-ACES-1.2\aces_1.2\config.ocio"
film.imagepipelines.1.4.src = "Utility - sRGB - Texture"
film.imagepipelines.1.4.dst = "Utility - Linear - sRGB"
film.outputs.4.type = "RGB_IMAGEPIPELINE"
film.outputs.4.filename = "2_conversions.exr"
film.outputs.4.index = 1
I still have some problems with HDRI background.
In ACES docummentation I have found that we should use "Output - sRGB" conversion. But this works only for png etc. This is logical as they are saved in sRGB color space. But what about exr? Somebody could help me with this. We are currently using "Utility - Linear - sRGB" but I'm not sure if it is correct.

Code: Select all

scene.lights.92450_BACKGROUND.gain = 16000 16000 16000
scene.lights.92450_BACKGROUND.transformation = -0.8660256 -0.4999998 0 0 -0.4999998 0.8660256 0 0 0 0 1 0 0 0 0 1
scene.lights.92450_BACKGROUND.id = 0
scene.lights.92450_BACKGROUND.temperature = -1
scene.lights.92450_BACKGROUND.temperature.normalize = 0
scene.lights.92450_BACKGROUND.visibility.indirect.diffuse.enable = 1
scene.lights.92450_BACKGROUND.visibility.indirect.glossy.enable = 1
scene.lights.92450_BACKGROUND.visibility.indirect.specular.enable = 1
scene.lights.92450_BACKGROUND.type = "infinite"
scene.lights.92450_BACKGROUND.file = "imagemap-00001.exr"
scene.lights.92450_BACKGROUND.colorspace = "opencolorio"
scene.lights.92450_BACKGROUND.colorspace.config = "your_path_to_aces/OpenColorIO-Config-ACES-1.2/aces_1.2/config.ocio"
scene.lights.92450_BACKGROUND.colorspace.name = "Utility - Linear - sRGB"
scene.lights.92450_BACKGROUND.storage = "float"
scene.lights.92450_BACKGROUND.gamma = 1
scene.lights.92450_BACKGROUND.sampleupperhemisphereonly = 0
scene.lights.92450_BACKGROUND.visibilitymapcache.enable = 0
Last thing. If you want to save the scene that is already in luxcore memory, don't worry when you find everywhere colorspace = "nop". This is because luxcore applies all cororspace conversion, ad if you open textures saved by luxcore, you will noticed, that they are in ACEScg color space.

Hope that this will be helpful for someone.
Last edited by bartek_zgo on Tue Jul 05, 2022 11:20 am, edited 1 time in total.
User avatar
Sharlybg
Donor
Donor
Posts: 3101
Joined: Mon Dec 04, 2017 10:11 pm
Location: Ivory Coast

Re: Color spaces support (aka OpenColorIO v2.0)

Post by Sharlybg »

Thank you very much Bartek for this really detail explanation
of ACES in Luxcore. This is going to help a lot. By The way I Think
you want to say ACEScg instead of " ACESng"
Support LuxCoreRender project with salts and bounties

Portfolio : https://www.behance.net/DRAVIA
User avatar
Sharlybg
Donor
Donor
Posts: 3101
Joined: Mon Dec 04, 2017 10:11 pm
Location: Ivory Coast

Re: Color spaces support (aka OpenColorIO v2.0)

Post by Sharlybg »

Thanks a kind Blender addon Developer on Twiter I have been able to Test
A first implementation of luxcore Aces with Blendluxcore 2.6 and blender 2.93 as test bench.

And here are the result. It much quite well Blender cycles behaviour :
Aces_Lux_Cy.jpg
Diffuse color input space seem to be right with ""Utility Raw"" instead of ""Utility Srgb Texture""

with ""Utility Srgb Texture"" this how color shift :
srgb v raw.jpg

The Sky color also look to be mangeable with the temperature option :
Sky_Luxcore.jpg
Support LuxCoreRender project with salts and bounties

Portfolio : https://www.behance.net/DRAVIA
Post Reply