0
$\begingroup$

I'm working on a Python script to automate the rendering of unique ID masks for objects in my Blender scene. The script assigns a vibrant, random color to each object and then composites them using CompositorNodeIDMask and CompositorNodeMixRGB (Multiply and Add modes) to create a single output image.

The core issue is that the colors in the final saved PNG file(File output node) are slightly different from the RGB values I've defined and written to a separate .txt file.

$\endgroup$

1 Answer 1

0
$\begingroup$

Sure, PNG will save in whatever color space your Display Device is set to and the colors will go through whatever color transform function you are using as well.

If you wanted to avoid that, you can save linear colors for example using EXR format, or you could change color management settings.

This is not a good idea

Using masks made from plain colors will be far worse than using actual proper Cryptomatte masks. Just enable Cryptomatte passes:

enter image description here

And then you can use Cryptomatte in the compositor. You can use Pick output to pick the objects:

enter image description here

And then it decodes the mask:

enter image description here

You can either use these masks straight in the compositor with Render Layers node, or with a loaded EXR image or you can export them using File Output nodes to whatever format. Cryptomatte also has plugins or support in other software so you can also open Multilayer EXR files with the masks. Like for example if you chose to use Phtoshop, there is a plugin for it and it can then read Multilayer EXRs and import masks as layers neatly named as well according to material or object names. Even though Photoshop might not be ideal for compositing, it's just an example.

$\endgroup$

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.