Chaos Corona Forum

Chaos Corona for 3ds Max => [Max] I need help! => Topic started by: LorenzoS on 2022-01-21, 12:39:16

Title: Alpha channel retain refraction information
Post by: LorenzoS on 2022-01-21, 12:39:16
Hi all,
a classic basic situation, glass on window with backgrond.
As you can see when the alpha channel is applaied the glass retain the refraction information and this is a problem if i want to change the background.
I think that it should be an option on material setup  (glass in this case) to retain only the trasparency information or only the reflection information.

At the moment my trick is create alpha from wirecolormask and apply to it the CESSENZIAL_reflect.
There is a more efficent way?

thank you
Title: Re: Alpha channel retain refraction information
Post by: maru on 2022-01-31, 16:25:21
Sorry, but the description of the issue is hard to understand. Could you please try rewording it?
What would greatly help is:
- explaining what exactly you are doing (what you are starting with and what is your end goal)
- showing the BEFORE images
- showing the AFTER images
- explaining what is the expected result and what is the result you are getting

I may be wrong, but I think you may be looking for the reflection/refraction propagation option: https://support.corona-renderer.com/hc/en-us/articles/4402621221521-How-to-use-Masks-with-Reflection-Refraction
Title: Re: Alpha channel retain refraction information
Post by: LorenzoS on 2022-01-31, 17:45:48
hi maru, thanks for the reply.
I try to explain better, look at the attached image:
- the image 1: it is the raw render without post production, a window with glass and an hdri image beyond the window.
-Image 2: I apply the alpha channel generated from the window glass and I get the transparency.
-Image 3: I insert a simple gray background in post production, now you see the "issue", the refraction data remains in the alpha channel, I think it shouldn't be there.
In fact, if I put any other background instead of the gray background, it would be disturbed by the refraction of the previous background.

PS: I saw the link and tried all the options, but it doesn't help.

thank you
Title: Re: Alpha channel retain refraction information
Post by: dj_buckley on 2022-01-31, 20:48:20
You'd need to override the refraction with black to get it to completely disappear no?

If there are no overrides, then the alpha just helps display the correct refraction strength rather than remove it completely.

Happy to be told I'm wrong, but that's my understanding
Title: Re: Alpha channel retain refraction information
Post by: LorenzoS on 2022-01-31, 21:15:01
thank you  dj_buckley, yes it works!!!

I still don't understand why the alpha channel incorporates refraction, we already have the CESSENTIAL_refract element that does this.
having the possibility to exclude the refractive component inside the material would be welcome.
But maybe i am wrong and not undestand something.

Title: Re: Alpha channel retain refraction information
Post by: maru on 2022-02-10, 14:12:56
Just letting everyone know that this is not forgotten, we are just dealing with a lot of various work right now. We will return here ASAP.
Title: Re: Alpha channel retain refraction information
Post by: maru on 2022-07-07, 10:47:16
Hi, better late than never, right?

Let's imagine two cases:
1. There is a hole in the wall (no glass, nothing, just wall geometry with a hole) and background behind it.
2. There is a hole in the wall with glass in it (like in the original example here).

If we render case 1 - the wall will be white in the alpha channel and the hole will be black.

If we render case 2 - the wall will be white, the hole will be black, but there will be some shade of gray where there is glass because the glass is not 100% transparent - it has some reflectivity.

If you imagine that there is a person in the room, standing next to the window, you would see this person's reflection in the window.
If you want to replace the background, you want to see the background behind the glass, but you also want to see the reflection of the person - right?
That's why the glass cannot be 100% black.

To overcome this, we can use the "trick" provided by dj_buckley. The directly visible background will be black, so no additional color will be added on top of the glass if you apply the alpha.

I hope this helps.


Title: Re: Alpha channel retain refraction information
Post by: LorenzoS on 2022-07-07, 20:17:43
Quote
If you imagine that there is a person in the room, standing next to the window, you would see this person's reflection in the window.
If you want to replace the background, you want to see the background behind the glass, but you also want to see the reflection of the person - right?
That's why the glass cannot be 100% black.

ok i can be agree on reflection case.
but not agree in refraction case.
The alpha channel retain also the refraction information and i think this is not correct behavior.
Title: Re: Alpha channel retain refraction information
Post by: LorenzoS on 2022-07-07, 20:57:02
...to explain better, the alpha channel should not retain the background information.

As you can see in attachment when i apply the alpha channel and insert a white layer behind, I keep seeing traces of the background.
Title: Re: Alpha channel retain refraction information
Post by: maru on 2022-07-08, 18:09:40
I may be wrong, but I still think this is because the glass material has some reflectivity (so it is because of reflection, not refraction component).

Is it the same if you go to the glass material > Advanced options and set "Alpha mode" to "Always black"?
Title: Re: Alpha channel retain refraction information
Post by: LorenzoS on 2022-07-08, 19:21:48
Quote
I may be wrong, but I still think this is because the glass material has some reflectivity (so it is because of reflection, not refraction component).

Is it the same if you go to the glass material > Advanced options and set "Alpha mode" to "Always black"?

don't works,i tried, the alpha channel lost all the reflection information.
Title: Re: Alpha channel retain refraction information
Post by: LorenzoS on 2022-07-08, 19:32:59
Quote
I may be wrong, but I still think this is because the glass material has some reflectivity (so it is because of reflection, not refraction component).
i think you  are rigth. The problem is the reflectivity on out side, infact if I try tu use a single face as glass and set the glass to thin shell i see always the background information on alpha channel
Title: Re: Alpha channel retain refraction information
Post by: LorenzoS on 2022-07-16, 18:05:44
I tried to use a "Duble Sided" material by putting a non-reflective material on the face that looks outward and the glass material on the face that looks inward, unfortunately it does not solve the problem.
Title: Re: Alpha channel retain refraction information
Post by: maru on 2022-07-18, 11:21:29
Quote
I may be wrong, but I still think this is because the glass material has some reflectivity (so it is because of reflection, not refraction component).

Is it the same if you go to the glass material > Advanced options and set "Alpha mode" to "Always black"?

don't works,i tried, the alpha channel lost all the reflection information.

Now I am completely confused. In your first posts, you are saying that you see the reflection information in the alpha channel and this is a problem to you. Now you are saying that the lack of reflection information is a problem to you. I do not understand your requirements.
Title: Re: Alpha channel retain refraction information
Post by: LorenzoS on 2022-07-18, 12:05:48
Quote
Now I am completely confused. In your first posts, you are saying that you see the reflection information in the alpha channel and this is a problem to you. Now you are saying that the lack of reflection information is a problem to you. I do not understand your requirements.
yes i confirm what i said.
There are 2 reflection component on glass: One on the face that looks inward and One on the face that looks outward.
The iussue is only the reflection on the face that looks outward that incorporate the background reflection, that is why i cann't substitute the bacground.
The reflection component of the internal face must remain otherwise I no longer have a glass but an empty hole.
Title: Re: Alpha channel retain refraction information
Post by: BardhylM on 2022-07-18, 12:29:59
I think what the problem is simpler to determine, but not so much to solve.
Glass always has a small amount of affecting the alpha, like its light gray. And that way when an image is saved, it is saved as a transparent image with that light gray value (for e.g just like 20% opacity in Photoshop) .
That "bakes" in the image the background image and the reflection of interior as one. So I am not aware that there is a way to separate them in this workflow, as it can be not determined in alpha what is reflection and what is background.

How I would do it is to override the background image in material opacity, make it black in direct visibility and refractions, leave reflections on if you want to project reflections on inside surfaces.
If you make it black totally it may darken the inside a little cause there are no reflections but a black color. If you render now you would get that light alpha again with interior reflections, but also in place of the background you get a black color. Not the best but you can work maybe with this.

If you do not want that black color to be mixed with your reflections(cause it darkens the glass a lot), you can make the glass material alpha always black, and add a reflections pass in render settings. That way you can put any background behind, you have light reflections inside, and with the reflections pass you can add the reflections in the glass as a additive layer.

Hope I did not complicate it, and helped a little!
Title: Re: Alpha channel retain refraction information
Post by: LorenzoS on 2022-07-18, 19:45:08
Quote
If you do not want that black color to be mixed with your reflections(cause it darkens the glass a lot), you can make the glass material alpha always black, and add a reflections pass in render settings. That way you can put any background behind, you have light reflections inside, and with the reflections pass you can add the reflections in the glass as a additive layer.
It is exactly my workflow at the moment.

But i hope in future a more usefull solution will be found.