Chaos Corona Forum

Chaos Corona for Cinema 4D => [C4D] I need help! => Topic started by: Mac3DX on 2022-12-27, 17:49:49

Title: Masking - leaking issue
Post by: Mac3DX on 2022-12-27, 17:49:49
Hi Guys, it was not supposed to behave like this, but I couldn't figure it out how to solve it. The textures are working fine in other 3D softwares.



Title: Re: Masking - leaking issue
Post by: BigAl3D on 2022-12-27, 18:54:16
That mask and diffuse files are NOT exact fits for each other. There is a slight difference. Maybe some other apps do a better job anti-aliasing those artifacts or you. Not sure.

The first thing I see is the way you set up your Layered Material. That seems backwards. Think real-world. Metal on the bottom then the label on top. Here is a screen grab of what I changed to get a clean edge.

It also works by using a simple color in the diffuse channel and then use your mask in the Opacity channel. Add the metal material to the object, then stack the label material to the right of the metal. Hope this helps.
Title: Re: Masking - leaking issue
Post by: Mac3DX on 2022-12-27, 19:24:27
Well at least it should. They were saved out from PS and as I said before this do not happen in Cycles and RS for instance.

Of course I provided a very simple material setup, but it might become very complex specially with packaging labels.

In your example we can clearly see a dark edge overlaying the red color. So we conclude the stacking order is not an argument.

Also to reinforce this theory is not relevant I masked only dielectrics materials, same issue again.

Anyway, I appreciate your efforts.


Title: Re: Masking - leaking issue
Post by: romullus on 2022-12-27, 19:44:06
It's not Corona's fault, it's simply your textures are flawed. Zoom in into your diffuse mask and you will see that you have white border baked into texture (look at the attachment). I don't know how your material setup looks like, but the easiest fix in this case would be replace "dif_mask.jpg" with the solid red colour.
Title: Re: Masking - leaking issue
Post by: BigAl3D on 2022-12-27, 19:48:21
Interesting. Well here is an example of a stacked material. Metal first, then the label is a solid color and just the mask in the opacity channel. I don't see a white or a dark edge on this technique.

I'm not a material master, but I'm good at finding workarounds to get me by. Curious to see the conclusion.
Title: Re: Masking - leaking issue
Post by: Mac3DX on 2022-12-27, 21:28:50
@BigAl3D Yes in this exemple it looks great! But it seems I'll have to add some sort of trapping to compensate the masks. I'll dig a bit more into this.

I've tried larger maps but it doesn't make a diference.

But I'm pretty sure Corona has some anti-aliasing going on behind the scenes and it is too strong.
Title: Re: Masking - leaking issue
Post by: burnin on 2022-12-28, 12:05:42
When layering materials, if you simply just use a mask, then you're fine (no borders, since color fills whole area equally). But when you got texture to match then know your Alpha channels: premultiplied vs straight (https://www.provideocoalition.com/alpha-channels-premultiplied-vs-straight/)
Title: Re: Masking - leaking issue
Post by: Mac3DX on 2022-12-28, 13:50:02
Thanks @burnin
I've heard about it, I'll read the article. But I managed to get around the problem quickly by contracting the mask a tiny bit in PS. It becomes acceptable.
Title: Re: Masking - leaking issue
Post by: maru on 2022-12-29, 16:16:12
Hmm, here the diffuse color should not have any white in it, right? It should be all red.
Title: Re: Masking - leaking issue
Post by: burnin on 2022-12-30, 17:32:41
Right... it's so simple, many just can't believe it ;)