MercenariesEngineering / openexrid

OpenEXR files able to isolate any object of a CG image with a perfect antialiazing
MIT License
128 stars 15 forks source link

DeepOpenExrId: "False color" option should create RGBA channels #8

Open Narann opened 5 years ago

Narann commented 5 years ago

Hello!

I realize enabling "false color" doesn't work if there is no RGB channel in source.

Here is a simple graph:

image

My deepread doesn’t have any RGB channel.

If I use it directly, like DeepOpenEXRId2 and set false color ON, and put my viewer on it, nothing appear, it’s black.

My only solution is to "force" a RGB channel to exists in the Deep graph merging two deep inputs (DeepOpenEXRId1).

If I enable false color on DeepOpenEXRId1, I have proper color.

I suspect the problem appear here:

https://github.com/MercenariesEngineering/openexrid/blob/master/nuke/DeepOpenEXRId.cpp#L320

The else statement is not reached if no RGB channel exists.

I suggest to add something like:

Channel redChannel = DD::Image::getChannel ("rgba.red");
Channel greenChannel = DD::Image::getChannel ("rgba.green");
Channel blueChannel = DD::Image::getChannel ("rgba.blue");

On top of doDeepEngine(), then, after needed += Mask_Alpha;, add:

if (_colors)
{
    needed += redChannel;
    needed += greenChannel;
    needed += blueChannel;
}

It should do the job but more test is obviously needed, maybe creating channel is done another way. The idea is simply to ensure RBGA is available when "false color" is enabled.

Thanks in advance, keep the good job!