Page MenuHome

Double post processing frames with color management, when animation rendered
Closed, ResolvedPublicBUG

Description

System Information
Operating system: Windows-7-6.1.7601-SP1 64 Bits
Graphics card: GeForce GTX 660 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 445.87

Blender Version
Broken: version: 2.90.0 Beta, branch: master, commit date: 2020-08-17 19:04, hash: rBe157573fab2a
Worked: (newest version of Blender that worked as expected)

Short description of error
For example increase gamma to 1.5 and render single image from viewport and single frame-animation from viewport.
For the second you will have 1.5 gamma applied twice. The same for filmic or other color management/correction

How it should be (similar result)

And how it looks (1 frame animation render on the right)

Full demo

File

Event Timeline

Germano Cavalcante (mano-wii) changed the task status from Needs Triage to Confirmed.Aug 25 2020, 1:10 AM

I can confirm.
It seems that rendering animation doubles color management processing.

Poke. Guys, it is important! It spoils animation direct renders.

Brecht Van Lommel (brecht) changed the subtype of this task from "Report" to "Bug".Jan 18 2021, 12:36 PM

When rendering an animation frame that would output to an 8bit video/image format performs the color management twice. Also on disk it is applied twice. This is because it is stored in a render buffer and the render buffer assumes that its internal buffer is always stored in Scene Reference Space.
This was introduced in 2.81 to increase the performance when performing viewport animation. As the cause is obvious the solution has to make sure to support all the different use cases there are.

  • BPY offscreen rendering to Scene reference space. (py_offscreen_draw_view3d calls ED_view3d_draw_offscreen with do_color_management=false).
  • VSE offscreen rendering to sRGB space
  • Viewport animation rendering to sRGB space (when saving to 8bit file format)
  • Viewport animation rendering to linear space (when saving to high bitdepth)
  • Viewport image rendering to linear space.

P1951 (source graphviz)

Basically looking at the graph we should not perform the in screen_opengl_render_doit as it would render incorrectly to any 8bit file and then also draws it incorrectly in the image editor.

diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c
index 5ae952738c9..ba2e23969c6 100644
--- a/source/blender/editors/render/render_opengl.c
+++ b/source/blender/editors/render/render_opengl.c
@@ -367,9 +367,6 @@ static void screen_opengl_render_doit(const bContext *C, OGLRender *oglrender, R
     char err_out[256] = "unknown";
     ImBuf *ibuf_view;
     const int alpha_mode = (draw_sky) ? R_ADDSKY : R_ALPHAPREMUL;
-    eImBufFlags imbuf_flags = oglrender->color_depth <= R_IMF_CHAN_DEPTH_8 ? IB_rect :
-                                                                             IB_rectfloat;
-
     if (view_context) {
       ibuf_view = ED_view3d_draw_offscreen_imbuf(depsgraph,
                                                  scene,
@@ -378,7 +375,7 @@ static void screen_opengl_render_doit(const bContext *C, OGLRender *oglrender, R
                                                  region,
                                                  sizex,
                                                  sizey,
-                                                 imbuf_flags,
+                                                 IB_rectfloat,
                                                  alpha_mode,
                                                  viewname,
                                                  oglrender->ofs,
@@ -397,7 +394,7 @@ static void screen_opengl_render_doit(const bContext *C, OGLRender *oglrender, R
                                                         scene->camera,
                                                         oglrender->sizex,
                                                         oglrender->sizey,
-                                                        imbuf_flags,
+                                                        IB_rectfloat,
                                                         V3D_OFSDRAW_SHOW_ANNOTATION,
                                                         alpha_mode,
                                                         viewname,

should fix this, but seems to renders workbench renders incorrect. the workbench renders are already incorrrect in master.