Corona masks RGB no clean edges why?

Hi chaps,

as you can easly understand from the subject of my topic I am getting mad when I have to extract the RGB mask passes from the render elements in Corona, especially if I have trees (and this means opacity channel with a bitmap for the leaves) in my scene I have noticed the edges are not cleaned at all, there is always a border of 1-2 pxl (I have already tried to save them in different formats, tiff, tga, png but always the same problem) and this is quite frustrtating because there are useles if I have to do PP in photoshop.

any suggestion about how fix this issue?

thanks in advance

Dan

I think I know what your problem is. But to be sure I understood right: Are you using a Mask RE for your trees or have you set up an RGB-pass: A render with ‘solid’ red, green and blue shaders combining 3 masks within an rgba-render?
Screenshot would be great, too. thanks

hey mate,

I have assigned an objectd Id for each object and then added a CMasking_Mask in RGB mode, please see attachement. with Vray I have never had this issues.. :confused:

missing one attachment sorry

I would recommend to use Mask RE, not the RGB-solution, because you might get in trouble when objects overlap. But from the last screenshot I see that you’re not rendering on a black BG?
BG always have to be black, otherwise you will get fringes in the edges.

so this means everytime I have to render out the masks i have to re-render the scene replacing the BG with just a black solid color? mh…let me try, thanks for the suggestion.

Best,

Dan

You don’t have to rerender. You render your beauty with a clean alpha(on black!) and then you add your sky/bg plate in post.

mh…ok I am not following you anymore.

I don’t need to replace the sky, for example I need to tweak the curves/levels for few objects, like the trees.

So even after I tried to render out the masks with a black BG (I have to use the option “Render only masks” because otherwise Max runs out of Ram and crashes ) the problem is still the same the edges of my masks are not clean and sharp and they are not able to work properly in photoshop.

or do a bit of googeling ‘premultiplied alpha’. I know it is a bit of pain in the ass, but beneficial once you get your head around it.

Can you check the bitmaps you are using for the leaves? Maybe the problem with the alpha is there.

I know how fix it easly in AE or Nuke, but in Photoshop is a bit limited. but the point is it must be come out correct for Max and Corona somehow.

It’s actually a limitation of PS. You can use the defringe command in PS but it’s destructive. There used to be a site with another way to set it up but it’s not online anymore and I don’t remember the details. But this also involved deleting image portions.
Another idea is the Mask Edge command which can be really useful and may get you there.

It’s actually a limitation of Corona :smiley:

At least additionally. Because unfortunately you don’t get a proper mask as soon as opacity is used.

This is not about aliasing or rendering on non-black/premultiplying. What dboldicotti wants to do is impossible right now with simple render elements because all of them: refraction, reflection and yes - even opacity (used here) is not handled correctly by masks at the moment.

Here is some kind of workaround - reminding of dark mr ages where you always had to have some additional “render elements scene”:

https://forum.corona-renderer.com/ Mask from object with transparency #msg106956

Good Luck

Straight to the point, thanks Frood to confirm my doubt about the masks elements.

Best

Dan

I can’t be sure how it would work in Corona, and I didn’t tried it for the last few years, but in the past I used to export passes with tga and uncheck “Pre-multipled Alpha”. In every viewer like XnView the picture would look strange, but in Photoshop and After Effects the edges would look just like it should. In AE I think you need to right click the image and select Interpret Alpha and select Unmultiplied or something.

Another benefit - if you leave “Compress” checked - that’s lossless (meaning identical to uncompressed) but very fast compression - so good for playback.
So Compress ON , Pre-multipled Alpha OFF

@Dan. Sorry man. I just saw your render against a nonblack BG and immediately thought of a premultiplying issue. Users complaining ‘can’t get rid of this fringe’ do usually something wrong with the alpha.

I am not able to do some tests, because I have no active license at the moment. But as I understood Frood: At the moment you can’t have a tree with ‘sprite’ mapped leaves and get a working RE mask for that? Is that right?

It is about to know what you’re target application expects: pre or unpremultplied. And you usually can tell your software how to treat the imported footage as well.

Sorry then, I assumed it’s the typical white fringe problem in PS. Not working with opacity masked geometry too often so didn’t come across this one… yet. Sorry for the confusion!

I just did some tests. I’m curious about opinions. It seems much easier to me, you don’t need to process with special premult nodes in Nuke, or run a defringe, or other stuff. And the objects are always perfect with no dark or white edges.

I saved some renders on a black background with alpha channel and merged them on a background in After Effects. The images are zoomed in 200% for clarity

regular png render - notice the dark edges :

png and in AE I selected "premultipled with black. Notice the white edges

tga saved with premult checked. Again dark edges.

tga with premult unchecked - perfect edges





Well, that’s the difference. Alpha works correctly. But this issue is about masks created by render elements like Cmasking_Mask. Try to do a standard rendering + mask for your foliage and adjust e.g. levels with that mask. It will be wrong because CMasking_Mask does not respect opacity values between 0 and 1 but only 0 (=no mask) and different from 0 (=mask).

Good Luck

And what about if material would have clip opacity checked on, would it still render wrong in masks?

Simple - if you will always render your beauty pass with a background in it. Your BG/Backplate blue/white/light pixels will bake in all of your corner pixels of your alpha channel. Windows corners etc and trees are the worst.

If you know that you will change you bg later on - render your image with black BG.

If you rendered it with a sky or some kind of color - sometimes in photoshop Layer>Matting (Defringe 1px) or remove white matte helps. But sometimes it does not help. Sometimes you can get artifacts etc - make it even worse.

Remember the smaller resolution you are rendering the worse it will get. I think 3-4k image minimum is good. For doing Layer>matting.

Good luck