This patch adds a new matte node that implements the Cryptomatte specification.
It also incluces a custom eye dropper that works outside of a color picker.
Cryptomatte export for the Cycles render engine will be in a separate patch.
Details
Diff Detail
- Branch
- comp_cryptomatte
- Build Status
Buildable 1843 Build 1843: arc lint + arc unit
Event Timeline
This is a patch against the current master. Should I rather rebase this on top of the 2.8 branch?
| source/blender/compositor/nodes/COM_CryptomatteNode.cpp | ||
|---|---|---|
| 36 | While it's not being used elsewhere yet, this hash function could be moved to a separate header file. What would be a good location for this? | |
Looks generally fine, comments inline.
| source/blender/compositor/nodes/COM_CryptomatteNode.cpp | ||
|---|---|---|
| 36 | Maybe rename BLI_hash_mm2a.h to BLI_hash_murmur.h, and then put both Murmur2A and Murmur3 in there. | |
| 43 | Use BLI_INLINE instead of custom FORCE_INLINE. | |
| 116 | Code style: for (...) {. | |
| 163–165 | Could use a union for this. | |
| 185 | Code style: while (...) {. | |
| 197–198 | Code style: always use {}. | |
| source/blender/editors/interface/interface_eyedropper_color.c | ||
| 365–389 | I don't think this needs a separate operator, it's also confusing to have two with the same name and description. I think you can adjust the UI_OT_eyedropper_color poll function to test prop && RNA_property_subtype(prop) == PROP_COLOR instead of but->type == UI_BTYPE_COLOR, and then it should work for both? | |
| source/blender/editors/space_node/node_edit.c | ||
| 2635 | Code style: always use {}. | |
| 2645 | Rename to NODE_OT_cryptomatte_socket_add and similar for remove, to follow typical operator naming. Maybe also replace "socket" by "pass"? To make it a bit more clear what is being added. Some description in the operator for when you would add more passes would also help. | |
| 2678–2682 | Same. | |
| source/blender/nodes/composite/nodes/node_composite_cryptomatte.c | ||
| 175 | Code style: { on new line. | |
| 195 | Code style: if (...) {. | |
| 205 | Code style: while (. | |
| 249 | Code style: if (...) {. | |
| 359 | I'm not sure what the render pass will be called in Cycles, but if it makes sense the same name could be used for the socket so it's a bit more obvious what is supposed to be linked here. | |
| source/blender/compositor/nodes/COM_CryptomatteNode.cpp | ||
|---|---|---|
| 163–165 | Sort of. While unions work in all compilers that we currently use, the C++ standard does not require compilers to support this kind of usage. I'll be happy to change this to union for style reasons. Memcpy() seems to me like the safer method though, and compilers typically are able to optimise this. C++20 will get bit casts to solve this problem in the language: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0476r1.html#bg | |
| source/blender/editors/interface/interface_eyedropper_color.c | ||
| 365–389 | Unfortunately, that doesn't work. Doing that results in a comical situation where the user is presented two inactive eye dropper buttons, where a button only become active when the mouse hovers over the other button. | |
x - Compositor: Addressed Brecht's comments for Cryptomatte node.
- Compositor: Added static sizeof() checks before type punning. Currently, sizeof(float) == 4 on all of our supported platforms, but the standards don't require that. You never know...
| source/blender/nodes/composite/nodes/node_composite_cryptomatte.c | ||
|---|---|---|
| 359 | The Cryptomatte standard doesn't require any specific naming. In practice, the passes tend to have "Crypto" in their names (e.g. "VrayCryptomatte", "uCryptoAsset", etc), so I now named the sockets "Crypto XX". | |
- More code styling changes in Cryptomatte compositing node.
- Code styling and warning suppression in murmur3 hash.
- Removed unused code.
Here are some UI tweaks on top of the patch, trying to make it a bit easier to understand for first time users.
- Make color picker dragging work for crypto, now allows you to easily select multiple objects by dragging.
- Tweak UI layout and added more detailed tooltips to explain how to use the node.
- Rename CryptoPick to Pick.
Besides that, if the CryptoPick output is fixed to always have alpha 1.0, I have no further concerns.
| source/blender/editors/interface/interface_eyedropper_color.c | ||
|---|---|---|
| 365–389 | It seems this bug is already happening in the ColorRamp node actually. | |
Also just noticed the matte_id string has a fixed size, with a few dozens objects you already run into that limitation.
- Compositor: Cryptomatte node now uses a dynamic string for matte ids, no more 1024 character limit.
- Compositor: Fixed Cryptomatte string handling.
- Compositor: Applied Brecht's UI improvements to Cryptomatte node
- Compositor: Fixed broken add/remove in Cryptomatte node.
- Compositor: Raised default number of Crypto inputs to three, as recommended by the Cryptomatte specification.
Looks good to me now, besides one accidental change.
| source/blender/makesdna/intern/makesdna.c | ||
|---|---|---|
| 20 ↗ | (On Diff #11430) | Accidental change should be removed. |