Is there any way i can have cleaner edges out of the cryptomatte image output ? The outline is just not clean enough.
-
1$\begingroup$ Cryptomattes are absolutely precise and deliver the masks that are required to my knowledge. Can you add some images to show what you are struggling with? $\endgroup$– aliasguruCommented Jun 25, 2019 at 11:07
-
$\begingroup$ @aliasguru i just put up a photo of what i meant $\endgroup$– kay777Commented Jun 30, 2019 at 11:37
-
$\begingroup$ I have posted an answer based on a guess what could have gone wrong. If you're having a different issue, please update the question with the relevant info. $\endgroup$– aliasguruCommented Jul 1, 2019 at 8:41
-
$\begingroup$ I was looking for a solution to this problem from the very first day since I have switched to Blender 4 years ago. I understand the benefits of Cryptomatte and different ways of usage. But I wanted just one easy pass with material ID with every render, which I can save to PNG and use in Photoshop. In the end, I have made my own addon. If it could help anybody, please enjoy it. blendermarket.com/products/cid $\endgroup$– JSM_ParametrCommented Jan 30, 2022 at 16:06
3 Answers
I assume your screenshot shows what you would see in the image editor if you have rendered cryptomatte passes, and view them directly. In that case, they look absolutely horrible:
However, that's not how they are supposed to be used. The mattes have to be extracted from the created channels first using the Cryptomatte
node. You can find it under Add
-> Mattes
-> Cryptomatte
in the Compositor. Connect the nodes like in the screenshot below to extract the object mattes:
If you need to extract material mattes, connect the three material Cryptomatte outputs to the Cryptomatte node instead.
Next comes the tricky part: The Cryptomatte render passes contain all mattes at once using an internal ID. That ID needs to be set in the node. Since these are not simple 1, 2, 3, etc numbers, you have to pick the correct ID using the color picker. That is also the reason why in the screenshot above I have used two Image Editors, one showing the Composite, the other the Viewer node. I can see both images, the Pick one through the Viewer, and the Image through the Composite node.
Now, use the color picker to grab the ID from the bottom image (the one that shows the Pick image):
If you check what's in the Matte socket output, you will see that the created Matte is perfectly anti-aliased:
Of course, this anti-aliasing quality is dependent on the scene samples. But the matte quality always matches the image quality.
Two things I would add to what's been shared so far:
1. You will also see a difference in edge quality based upon Cycles Render Properties>Film>Pixel Filter settings. Filter "Type" and pixel "Width" will give you wildly different edges, ranging from super crunchy to sharp and smooth to blurry. Automatically, you should get mattes that match your renders.
2. A perfect matte will FAIL on edges if your subject and background are merged like in a photo, live video recording, or a 3D scene that is not done in separate subject / background layer passes. This foundational video by CG Cookie really opened my eyes to this and how to workaround it when you don't have separate render layers: Working with Alpha Edges for Compositing in Blender. Although the video is from 2013, way before Cryptomattes, the principles and techniques still apply and can be combined wonderfully with Cryptomattes. Basically, you have to use choke mattes and inpaint nodes to separate the subject from the background and decontaminate the edges from color blending. I hope this helps you!
-
$\begingroup$ Do you mind adding a meaningful comparison of the defaults vs. blackman-harris? Thanks $\endgroup$ Commented Apr 7, 2020 at 6:36
-
$\begingroup$ Blackman-Harris @ 1.50 px is default for Cycles as of 2.82a with a nice balance of sharpness and anti-aliasing. Box is sharper with no adjustable pixel settings. Gaussian is generally soft with adjustable pixel width. The nice thing about Cryptomattes is that they will automatically match the sharpness of your edges based upon pixel filter settings. $\endgroup$ Commented Apr 7, 2020 at 7:37
-
$\begingroup$ Thanks Coby. I need to test that. However, I think Cryptomatte should work out of the box so any side by side image comparison might be nice to get your idea. $\endgroup$ Commented Apr 7, 2020 at 8:12
I was also facing the same issue with my cryptomatte passes, like absolutely torn edges, even though I was not able to pick any object, material, or asset. And sometimes when I clicked on any object it was showing a random number in the selection field on cryptomatte node.
I've tried as many tricks and techniques as I could but no difference, like researching issues specifically on cryptomatte passes. It was Blender 3.2 with RTX 2070 Super using Cycles at 2048 samples. After doing all that stuff I found that the new version of Blender 3.3.1 is released and I just installed it. And guess what, the issue with torn grainy cryptomatte passes is solved. It was the issue with 3.2 and it was nothing but a bug.
I'll suggest that anybody who is running into this bad cryptomatte passes issue, just go the blender.org and update to the latest version specially LTS and you're good to go.
Best