Better Material / Object masking using value ranges
Something I noticed, even with the new cryptomatte system, is that the quality of the masks is still pretty low.
It seems that each material / object / crypto mask is binary IE: It is either part of the material or not. This means aliased edges and really messy motion blur.
Form what I can tell this is a limit of the current implementation. What I propose is a system (or at least the option) to assign ranges to each mask. Obviously there are only so many bits to go around, but in a scene where I only need 4 or so masks, assigning 32 brightness values to each mask would be perfect.
4 Comments
Where in Blender's interface would you make the assignment of ranges? A mock-up would be useful that shows both the interface you envision as well as what the rendered masks would look like.
* @Jason van Gumster * {attachment maskMockuppng} Something like this. The current implementation uses pixel brightness, so if you select something with an ID of 1 in the compositor, it isolates everything with a brightness of 1. This means only one brightness value per mask, and no (true) anti-aliasing, or semi-transparent masks.
My proposal is to use an offset system. Using a range of 256 for example, a mask with an ID of 0 would get brightness values between 0-256, a mask with an ID of 2 would be 257-512, and so on.
These ranges could then be mapped to brightest and darkest IE: Mask 2 with range 257-512, pixels that were 257 would be mapped to black, and 512 would be mapped to whatever the max brightness was.
It's not a perfect system. The bigger the range, the fewer overall masks you could use (which is why we would need to give users control), and a better way to do ID masks all together would probably be better, but if we are sticking with the current system this would be a huge improvement.
* @Zach Hixson * This is pretty helpful... though I'd perhaps like to see what a composite would look like using ID masks generated from such a system and how it has advantages of how things are currently done (on a bunch of different compositing applications, if I recall correctly).
* @Jason van Gumster * Like I said, the advantage would be that masks support motion blur, transparency, and actual anti-aliasing.
I am currently working on a project which needs to use masks for stylized color correction, and any motion blurred masks ends up as dithered noise producing some really strange effects. I had to resort to manually setting the material I want masked to holdout, setting the composite to the inverted alpha, and then individually rendering out each mask by itself which is really inconvenient but produces perfect masks. It also means I can't use the compositor in the same .blend file, and instead have to render them all out, and then composite them separately.
The mask with 256 values would look something like this: {attachment rawpng}