This task will go over improvements I want to suggest to the Draw Manager Colormanagement,. This ticket is in discussion, in the hope to get viewpoints of other experts about the subject.
The scope of this ticket is limited to the draw manager as there are some isolated issues here. its use-cases and where current performance penaltiesWhen the design is completed we can create an engineering design on the how.
**Current Situation**
DrawManager is used in many areas with other target colorspace needs than currently available. DrawManager has a flag do_colormanagement, what can be on or off. When on it is up to the draw engines to do the correct expected actions for color management. Most of the time this has been implemented with a lot of assumptions and un-clarity about the colorspace the buffers are currently in.
For example:
* Workbench and Grease Pencil assumes that this flag can be used to detect how their input and output buffers needs to be handled (Linear vs sRGB). Both don't use the scene color management settings for this, but uses fix transform functions.
* Overlay engines assumes that their input and output is always in sRGB.
Usages of DrawManager
* Drawing of the 3d viewport to the display: the draw manager will render workbench, eevee, greasepencil, external render engines and additional overlays directly to the device output.
* Viewport rendering: The draw manager will render workbench, eevee, greasepencil, external render engines and additional overlays to an render result. results are stored in Scene ref space.
* Scene Strip: the draw manager will render workbench/eevee and greasepencil results are stored in an ImageBuffer.
* Image Rendering: the draw manager will render workbench/eevee and greasepencil results is stored in an Image buffer in Scene ref space
* PyAPI: opengl_render
**Issues**
* When doing viewport rendering the color management is done on the CPU what is typically slow.
* When doing viewport rendering the overlay engine assumes that the input/output buffers are sRGB, but in fact they aren't, they are still scene linear.
* When using a scene strip the buffer is not converted to sequencer, but to the sRGB. With the default settings these are the same, but when users change it...
* Rendering greasepencil results in different results in the different modes.
* Movieclips/Images as Camera Background Images/Image empties do not respect color management settings.
* ...
**Proposal**
* g* Generated GLSL color transfer functions by OpenColorIO configuration. `common_colormanagement_lib.glsl`. Make the functions OpenColorIO role based. this way it is more clear what function to use in what situation.
* To be able to set a target OpenColorIO role, when drawing to an offscreen buffer. This will increase viewport rendering performance.
* make* Make sure that when overlays are drawn, the input buffers are transferred to the correctexpected color space (display), and transferred back afterwards.