Page MenuHome

Python Accessing Viewer Node results in Darker Image Than Render
Closed, ArchivedPublic

Description

System Information
Operating system: Windows-10-10.0.19044-SP0 64 Bits
Graphics card: AMD Radeon(TM) Graphics ATI Technologies Inc. 4.5.14830 Core Profile Context 21.10 27.20.21026.3004

Blender Version
Broken: version: 3.3.0 Alpha, branch: master, commit date: 2022-07-12 16:47, hash: rBd0a552b5c602
Worked: None
Also tested on Blender version: 3.2.0, branch: master, commit date: 2022-06-08 10:22, hash: rBe05e1e369187 and does not work.

Short description of error
The image when retrieved through the viewer node is much darker than the actual render. Happens consistently when the provided script is ran. This happens with any render engine, but does differ when using the AMD Radeon ProRender render engine. It is still not quite right when using the ProRender, but it is different.

Exact steps for others to reproduce the error

Note: Instructions are for Windows 10

  • Open default Blender
  • Open Command Prompt and navigate to the Blender '\bin' folder. Mine was '~\blender-3.3.0-alpha+master.<commitID>-windows.amd64-release\blender-3.3.0-alpha+master.<commitID>-windows.amd64-release\3.3\python\bin'. It should be along the lines of 'Program Files\Blender Foundation\Blender #.#\#.#\python\bin' if using a stable Blender version
  • Execute the following command to install external Python packages to Blender 'python -m install opencv-python'. The 'python\lib\site-packages' should have the OpenCV and Numpy packages installed
  • In Blender, open the provided Python script
  • Change the savings path on lines 32 and 44 to one that you prefer
  • Execute the script
  • The outputted images will be a darker one from the viewer node, and the normal one from the standard rendering process

Event Timeline

Omar Emara (OmarSquircleArt) changed the task status from Needs Triage to Needs Information from User.Jul 18 2022, 6:39 PM

The difference seems to be that Blender applies color management while OpenCV just saves the raw colors. The content of image.pixels does not have color management applied. So I don't think this is a bug, can you confirm that?

Yes, color management is not applied as confirmed by this post: https://stackoverflow.com/questions/65719891/pixels-retrieved-from-viewer-node-within-blender-are-darker-than-the-actually-re. That is the bug/new feature I am reporting since it is impossible to retrieve any correctly colored render image without writing it to disk first.

You can use the color space utilities provided by the mathutils module to convert the pixel values from scene linear space into whatever space you like. https://docs.blender.org/api/current/mathutils.html#mathutils.Color
Perhaps using from_scene_linear_to_srgb in your case.

But the issue reported here is a request for modified/improved behavior and not a bug in current behavior. Closing as this bug tracker is only for bugs and errors.

For user requests and feedback, please use other channels: https://wiki.blender.org/wiki/Communication/Contact#User_Feedback_and_Requests

For more information on why this isn't considered a bug, visit: https://wiki.blender.org/wiki/Reference/Not_a_bug

Got it. Thank you for the help regardless! The linear to sRGB transformation did seem to work.