Picture Viewer does not display correct colors for RenderDocument bitmap
-
Please excuse for bumping this thread - however we tried to follow up with maxon technical support but where quickly redirected to the forums.
We are currently also running into issues, where in Cinema4D 2025.1.x the color profile for rendering seems to be "wrong" when the rendering is triggered via the python sdk.
In your projects, we use the following settings:
When rendering via CLI (
Commandline.exe
) or the Desktop Application this works without problem. However when using the python SDK the images come out as the "default profile" which is unfortunatelyun-tone mapped
The code for rendering is from AWS DEADLINE CLOUD - a render farm manager - excerpt
bm = bitmaps.MultipassBitmap( int(self.render_data[c4d.RDATA_XRES]), int(self.render_data[c4d.RDATA_YRES]), c4d.COLORMODE_RGB, ) rd = self.render_data.GetDataInstance() result = c4d.documents.RenderDocument( self.doc, rd, bm, c4d.RENDERFLAGS_EXTERNAL | c4d.RENDERFLAGS_SHOWERRORS, prog=progress_callback, )
Full function available here: https://github.com/aws-deadline/deadline-cloud-for-cinema-4d/blob/mainline/src/deadline/cinema4d_adaptor/Cinema4DClient/cinema4d_handler.py#L69-L110
It's a bit frustrating - as right now there seems to be no way of ensuring that the custom ACEScg space can be used via python.
I've also been toying around to reproduce this without Deadline cloud - and the following code showcases the problem as well:
import c4d from c4d import bitmaps def main() -> None: doc = c4d.documents.GetActiveDocument() render_data = doc.GetActiveRenderData() render_data[c4d.RDATA_FRAMESEQUENCE] = c4d.RDATA_FRAMESEQUENCE_MANUAL frame = 61 fps = doc.GetFps() render_data[c4d.RDATA_FRAMEFROM] = c4d.BaseTime(frame, fps) render_data[c4d.RDATA_FRAMETO] = c4d.BaseTime(frame, fps) render_data[c4d.RDATA_FRAMESTEP] = 1 bm = bitmaps.MultipassBitmap( int(render_data[c4d.RDATA_XRES]), int(render_data[c4d.RDATA_YRES]), c4d.COLORMODE_RGB, ) bm.SetColorProfile(render_data[c4d.RDATA_IMAGECOLORPROFILE]) rd = render_data.GetDataInstance() res: int = c4d.documents.RenderDocument(doc, rd, bm, c4d.RENDERFLAGS_EXTERNAL) print("rendering") if res == c4d.RENDERRESULT_OK: print("done") bm.Save("test.png", c4d.FILTER_PNG, None,) c4d.bitmaps.ShowBitmap(bm) if __name__ == '__main__': main()
The image that is shown via ShowBitmap has the correct color profiles. The saved one is missing the display pipeline. Saving the image from the picture viewer misses the transform - only when explicitly embedding it, it is correct
Can you provide any information when this can/will be addressed ? Thank you
-
Hello @patrick_cue,
Welcome to the Maxon developers forum and its community, it is great to have you with us!
Getting Started
Before creating your next postings, we would recommend making yourself accustomed with our forum and support procedures. You did not do anything wrong, we point all new users to these rules.
- Forum Overview: Provides a broad overview of the fundamental structure and rules of this forum, such as the purpose of the different sub-forums or the fact that we will ban users who engage in hate speech or harassment.
- Support Procedures: Provides a more in detail overview of how we provide technical support for APIs here. This topic will tell you how to ask good questions and limits of our technical support.
- Forum Features: Provides an overview of the technical features of this forum, such as Markdown markup or file uploads.
It is strongly recommended to read the first two topics carefully, especially the section Support Procedures: Asking Questions.
About your First Question
Please do not use other topics for your support requests, especially when they are bug tickets. Asking a follow-up questions such as "when will this be fixed" or "does this also apply to situation B" in a foreign topic is allowed and even encouraged.
But a specific case with your specific code and data always warrants a new thread. Please also familiarize yourself with Support Procedures: Asking Questions, as while it its clear that you put effort into make yourself understood (thanks!), this is also bordering a bit on the too much information.
The bug tracked by the other topic, is that there is currently no way in the Python API to use
c4d.documents.RenderDocument
in an OCIO document (i.e., every document since 2025.0) and then display that bitmap with the correct colors viac4d.bitmaps.ShowBitmap
. It is important to understand that:The bitmap data generated is just fine, when you save the bitmap to disk, everything is correct. It is just that the Picture Viewer does not display it incorrectly.
The reason for that is that in Python OCIO is not fully exposed in 2025.1.0 and you cannot set the OCIO profiles of the rendered bitmap there. Internally, we have been working on an OCIO port for Python allowing for color conversions and more things, including OCIO managing bitmaps. We also added a function to bake a display and view transform into an sRGB image - another route how this
RenderDocument
issue can be solved.The goal is to publish this with an upcoming version of the Python SDK, ideally the next, but as always we cannot make any guarantees. You cannot fix this issue yourself in 2025.1.0 and lower.
Cheers,
Ferdinand