Double post processing frames with color management, when animation rendered #79999

Closed
opened 2020-08-22 03:17:31 +02:00 by Vyacheslav Kobozev · 14 comments

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: e157573fab
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)
49464312.png

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

Full demo
2020-08-22_04-07-41.mp4

File
double post processing.blend

**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: `e157573fab` 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) ![49464312.png](https://archive.blender.org/developer/F8802170/49464312.png) And how it looks (1 frame animation render on the right) ![49474414.png](https://archive.blender.org/developer/F8802176/49474414.png) Full demo [2020-08-22_04-07-41.mp4](https://archive.blender.org/developer/F8802165/2020-08-22_04-07-41.mp4) File [double post processing.blend](https://archive.blender.org/developer/F8802179/double_post_processing.blend)

Added subscriber: @Vyach

Added subscriber: @Vyach

Added subscriber: @mano-wii

Added subscriber: @mano-wii

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'

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

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

Added subscriber: @EAW

Added subscriber: @EAW
Member

To me, this looks like this is the combination of this intentional change in 2.82: 7959dcd4f6 and this change in 2.83+: 190fd795a9 that causes the issue reported in #77909 (2.83lts Regression: Viewport render image ignores colormanagement, and appears to be hardcoded to use sRGB.)

To me, this looks like this is the combination of this intentional change in 2.82: 7959dcd4f6 and this change in 2.83+: 190fd795a9 that causes the issue reported in #77909 (2.83lts Regression: Viewport render image ignores colormanagement, and appears to be hardcoded to use sRGB.)

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

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

poke

poke
Jeroen Bakker self-assigned this 2021-01-25 16:35:04 +01:00
Member

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)
graphviz.png

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.

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](https://archive.blender.org/developer/P1951.txt) (source graphviz) ![graphviz.png](https://archive.blender.org/developer/F9750589/graphviz.png) 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.
Member
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.

``` 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.

This issue was referenced by e954e565e1

This issue was referenced by e954e565e1a83e2018278a4be73f5c7ecd22ec45

This issue was referenced by 837b5743ce

This issue was referenced by 837b5743ced83c5dfe724a8285eee504f623dbfb

This issue was referenced by 33145dd187

This issue was referenced by 33145dd187e30916f4ebae81ca0540b9c325b480
Member

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#79999
No description provided.