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 »

TAO wrote: Fri Aug 13, 2021 11:08 am Add color space rollout In the camera option section below the LUT.
Screenshot 2021-08-13 125105.jpg
Camera is probably better to be associated with the "Outputs", not the "Inputs" lable. Here you should be able to define the config file and the color space output or display out.

This is also part of the tone mapping process, so it should be a tone mapper option inside the combo box, not a separate tab.

I can add utility functions to LuxCore API to have the list of available "Color spaces", "Displays", etc. So you can use a combo box instead of generic text input.
TAO wrote: Fri Aug 13, 2021 11:08 am Add color space node in the material editor, so it can be used for textures and other nodes.
Screenshot 2021-08-13 125038.jpg
Yes, correct, you probably want to have a "default config" option by default (i.e. the OCIO config file used for the camera).

Is it Blender ? Blender has already its support for OCIO so we should probably read some information (i.e. the config file name) from the preferences or wherever Blender store that kind of stuff :idea:
Support LuxCoreRender project with salts and bounties
User avatar
TAO
Developer
Developer
Posts: 851
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 Aug 13, 2021 11:35 am Camera is probably better to be associated with the "Outputs", not the "Inputs" lable. Here you should be able to define the config file and the color space output or display out.

This is also part of the tone mapping process, so it should be a tone mapper option inside the combo box, not a separate tab.

I can add utility functions to LuxCore API to have the list of available "Color spaces", "Displays", etc. So you can use a combo box instead of generic text input.

Yes, correct, you probably want to have a "default config" option by default (i.e. the OCIO config file used for the camera).

Is it Blender ? Blender has already its support for OCIO so we should probably read some information (i.e. the config file name) from the preferences or wherever Blender store that kind of stuff :idea:
am I getting it correctly?

For node editor, adding a global option to read defaults camera settings from the camera, also adding a few presets.
Screenshot 2021-08-13 171955.jpg
inside the camera tone mapper section, adding the OCIO as a tone map with a few preset and the ability to select a config file.
Screenshot 2021-08-13 173157.jpg
blender color management options are a little confusing to me, maybe because I'm totally new to blender.
render_post-process_color-management_panel.png
render_post-process_color-management_panel.png (6.74 KiB) Viewed 8863 times
All i can find is here. i think we can read the data if there is no option selected in luxcore tone map or override it.
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 »

Dade wrote: Fri Aug 13, 2021 11:23 am
richardbao wrote: Fri Aug 13, 2021 2:25 am So, do we have "looks" implemented already? or will we?
OCIO "Looks" are something similar to a macro: you can get the same result by using/chaining other OCIO tools. However it can get quite complicated so I'm adding the direct support for looks.
I have added the support for OCIO "Looks". There is an new TONEMAP_OPENCOLORIO mode named LOOK_CONVERSION to apply looks:

Code: Select all

# Using a look mode
film.imagepipelines.0.0.type = TONEMAP_OPENCOLORIO
film.imagepipelines.0.0.mode = LOOK_CONVERSION
film.imagepipelines.0.0.config = deps/filmic-blender-1.1.1/config.ocio
film.imagepipelines.0.0.src = Linear
film.imagepipelines.0.0.look = "Very High Contrast"
#
film.imagepipelines.0.1.type = TONEMAP_OPENCOLORIO
film.imagepipelines.0.1.mode = DISPLAY_CONVERSION
film.imagepipelines.0.1.config = deps/filmic-blender-1.1.1/config.ocio
# NOTE: the previous "Look" produce an output in "Filmic Log Encoding" color space
film.imagepipelines.0.1.src = "Filmic Log Encoding"
film.imagepipelines.0.1.display = sRGB
film.imagepipelines.0.1.view = "sRGB OETF"
But the most handy mode is probably to use the new ".look" property of DISPLAY_CONVERSION:

Code: Select all

# Using a display mode with look
film.imagepipelines.0.0.type = TONEMAP_OPENCOLORIO
film.imagepipelines.0.0.mode = DISPLAY_CONVERSION
film.imagepipelines.0.0.config = deps/filmic-blender-1.1.1/config.ocio
film.imagepipelines.0.0.src = Linear
film.imagepipelines.0.0.display = sRGB
film.imagepipelines.0.0.view = "sRGB OETF"
film.imagepipelines.0.0.look = "Very High Contrast"
This should produce produce exactly the same output of Blender color management (however it may require some testing and cross check because there are couple of things I'm not 100% sure).
Support LuxCoreRender project with salts and bounties
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 Aug 13, 2021 4:01 pm am I getting it correctly?
I think we need first to understand how Blender color management works: people will expect the LuxCore support will be similar/coherent with Blender default one.

This is the Blender color management documentation page: https://docs.blender.org/manual/en/late ... ement.html

By looking at Blender code (always more clear than documentation), the color management work already out of the box with LuxCore. It is something done after the rendering so we should have plain nothing to do for the "outputs": just provide the rendering in linear FP32 color space.

However we need to handle the "inputs" correctly and coherently with Blender color management settings.
Support LuxCoreRender project with salts and bounties
User avatar
TAO
Developer
Developer
Posts: 851
Joined: Sun Mar 24, 2019 4:49 pm
Location: France
Contact:

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

Post by TAO »

Dade wrote: Sun Aug 15, 2021 11:14 am
TAO wrote: Fri Aug 13, 2021 4:01 pm am I getting it correctly?
I think we need first to understand how Blender color management works: people will expect the LuxCore support will be similar/coherent with Blender default one.

This is the Blender color management documentation page: https://docs.blender.org/manual/en/late ... ement.html

By looking at Blender code (always more clear than documentation), the color management work already out of the box with LuxCore. It is something done after the rendering so we should have plain nothing to do for the "outputs": just provide the rendering in linear FP32 color space.

However we need to handle the "inputs" correctly and coherently with Blender color management settings.
My experience with Blender is so little, that I'm afraid to make things in the wrong way. We may need a more experienced developer like B.O.B.Y to look at the current way that blender handles the Color managment.
in other parts, i can help to speed up the development process.
User avatar
richardbao
Posts: 17
Joined: Tue Mar 09, 2021 7:47 am

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

Post by richardbao »

Dade wrote: Sun Aug 15, 2021 11:10 am
Dade wrote: Fri Aug 13, 2021 11:23 am
richardbao wrote: Fri Aug 13, 2021 2:25 am So, do we have "looks" implemented already? or will we?
OCIO "Looks" are something similar to a macro: you can get the same result by using/chaining other OCIO tools. However it can get quite complicated so I'm adding the direct support for looks.
I have added the support for OCIO "Looks". There is an new TONEMAP_OPENCOLORIO mode named LOOK_CONVERSION to apply looks:

Code: Select all

# Using a look mode
film.imagepipelines.0.0.type = TONEMAP_OPENCOLORIO
film.imagepipelines.0.0.mode = LOOK_CONVERSION
film.imagepipelines.0.0.config = deps/filmic-blender-1.1.1/config.ocio
film.imagepipelines.0.0.src = Linear
film.imagepipelines.0.0.look = "Very High Contrast"
#
film.imagepipelines.0.1.type = TONEMAP_OPENCOLORIO
film.imagepipelines.0.1.mode = DISPLAY_CONVERSION
film.imagepipelines.0.1.config = deps/filmic-blender-1.1.1/config.ocio
# NOTE: the previous "Look" produce an output in "Filmic Log Encoding" color space
film.imagepipelines.0.1.src = "Filmic Log Encoding"
film.imagepipelines.0.1.display = sRGB
film.imagepipelines.0.1.view = "sRGB OETF"
But the most handy mode is probably to use the new ".look" property of DISPLAY_CONVERSION:

Code: Select all

# Using a display mode with look
film.imagepipelines.0.0.type = TONEMAP_OPENCOLORIO
film.imagepipelines.0.0.mode = DISPLAY_CONVERSION
film.imagepipelines.0.0.config = deps/filmic-blender-1.1.1/config.ocio
film.imagepipelines.0.0.src = Linear
film.imagepipelines.0.0.display = sRGB
film.imagepipelines.0.0.view = "sRGB OETF"
film.imagepipelines.0.0.look = "Very High Contrast"
This should produce produce exactly the same output of Blender color management (however it may require some testing and cross check because there are couple of things I'm not 100% sure).

Thanks for the OCIO "Look" support!
i am still trying to test the look and could not get it working without crash though.
however, I had some questions about the config of the first method you mentioned above.
Imho, I suppose we should first apply view ,then apply looks.

Code: Select all

film.imagepipelines.0.0.type = TONEMAP_OPENCOLORIO
film.imagepipelines.0.0.mode = DISPLAY_CONVERSION
film.imagepipelines.0.0.config = deps/filmic-blender-1.1.1/config.ocio
# NOTE: the previous "Look" produce an output in "Filmic Log Encoding" color space
film.imagepipelines.0.0.src = "Linear"
film.imagepipelines.0.0.display = sRGB
film.imagepipelines.0.0.view = "sRGB OETF"
# Using a look mode
film.imagepipelines.0.1.type = TONEMAP_OPENCOLORIO
film.imagepipelines.0.1.mode = LOOK_CONVERSION
film.imagepipelines.0.1.config = deps/filmic-blender-1.1.1/config.ocio
film.imagepipelines.0.1.src = sRGB OETF
film.imagepipelines.0.1.look = "Very High Contrast"
i am still confused about this a little a bit, do you have any reference or code on how blender implement this?
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 »

richardbao wrote: Wed Aug 18, 2021 10:18 am Thanks for the OCIO "Look" support!
i am still trying to test the look and could not get it working without crash though.
Can you post a way to reproduce your crash ?
richardbao wrote: Wed Aug 18, 2021 10:18 am however, I had some questions about the config of the first method you mentioned above.
Imho, I suppose we should first apply view ,then apply looks.

Code: Select all

film.imagepipelines.0.0.type = TONEMAP_OPENCOLORIO
film.imagepipelines.0.0.mode = DISPLAY_CONVERSION
film.imagepipelines.0.0.config = deps/filmic-blender-1.1.1/config.ocio
# NOTE: the previous "Look" produce an output in "Filmic Log Encoding" color space
film.imagepipelines.0.0.src = "Linear"
film.imagepipelines.0.0.display = sRGB
film.imagepipelines.0.0.view = "sRGB OETF"
# Using a look mode
film.imagepipelines.0.1.type = TONEMAP_OPENCOLORIO
film.imagepipelines.0.1.mode = LOOK_CONVERSION
film.imagepipelines.0.1.config = deps/filmic-blender-1.1.1/config.ocio
film.imagepipelines.0.1.src = sRGB OETF
film.imagepipelines.0.1.look = "Very High Contrast"
i am still confused about this a little a bit, do you have any reference or code on how blender implement this?
Nope, Look is actually applied before the Display "transformation" both in LuxCore and Blender. Display is always the very last step because it is a way to transform the final image in something appropriate for the characteristic of your display.

This is the LuxCore code: https://github.com/LuxCoreRender/LuxCor ... o.cpp#L159

And this is the Blender code: https://github.com/blender/blender/blob ... ent.c#L865 (actually, my local copy of Blender source must be older and it is easier to read because they have wrapped all OCIO functions ... no idea why)

Note: Blender uses the second method I posted, not the one you quoted in your message.
Support LuxCoreRender project with salts and bounties
User avatar
TAO
Developer
Developer
Posts: 851
Joined: Sun Mar 24, 2019 4:49 pm
Location: France
Contact:

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

Post by TAO »

Dade wrote: Sun Aug 15, 2021 11:14 am
TAO wrote: Fri Aug 13, 2021 4:01 pm am I getting it correctly?
I think we need first to understand how Blender color management works: people will expect the LuxCore support will be similar/coherent with Blender default one.

This is the Blender color management documentation page: https://docs.blender.org/manual/en/late ... ement.html

By looking at Blender code (always more clear than documentation), the color management work already out of the box with LuxCore. It is something done after the rendering so we should have plain nothing to do for the "outputs": just provide the rendering in linear FP32 color space.

However we need to handle the "inputs" correctly and coherently with Blender color management settings.
As I can see, Blender manages color space really straight and forward, all color space will be the same for all input and output options as selected options in the color management menu and they are a small list of support options.
If we look at this as a reference it just needs to be translated to Luxcore settings and that's all we need to do. because all input and other options will be relevant to the global settings. if that is the correct way of how to do it I can get start the coding.
if we want more options and freedom then we need nodes in maps and other options we mention in a few posts earlier.

I dig a little bit about how the other rendered in other software workaround color management and I found Arnold and Corona used The Academy Color Encoding System (ACES) and implemented in just one single global option for all input, output, etc.
https://docs.arnoldrenderer.com/display ... S+Workflow
Good article to read that has more details in the Color Management article compare to blender documentation.
How Maya manages OCIO/ACES.
image2021-5-5_16-7-53.png
Global settings in 4 sections, config file, input, transform, output

I think if i add one section in the image pipeline and put all OCIO settings on it i will be exactly what we need. of course if the OCIO color management is selected and enabled the blender color management needs to be set as raw as it is in LUT at the moment.

in material editor one option for select color space.
Screenshot 2021-08-22 172611.jpeg
for colors
Screenshot 2021-08-22 172744.jpeg
for textures
it can work in the blender with a simple color space node.
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 »

Since blender Filmic look to be ACES based but not in its complete form from what i was able to understand.
Some artist on internet just override the complete blender color management system with ACES 1.1.
And of course they look different : https://youtu.be/B7FWNNDXBl0
by Ton Roosendal: ACES is a color space, Filmic is a view transform.
But seriously I don't know where to look.
It is so confusing. so many different opinion even from colour artist :

THIS IS A PURE MESS. You can basically meltdown any brain with that :lol: :lol:

look at that : https://blenderartists.org/t/installed- ... 1236883/30
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 »

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.
What is the primary color space internally use by the linear fp32 of luxcore sRGB? AdobeRGB? ProPhoto RGB? Rec2020? DCI P3?

Or now we support : ACEScg (ACES AP1 primaries) ?
Support LuxCoreRender project with salts and bounties

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