12
$\begingroup$

I'm trying to render some windows, reflecting an environment map, and to be transparent to let light enter inside the house. There are two windows facing each, and I need to see through both, and keep the alpha channel here.

Here are the window's material nodes that do (half) the trick :

enter image description here

But, as you can see, there is no reflection on windows, which is needed. The is Camera Ray is overriding the reflections too. But if I don't add the is Camera Ray to the is Shadow Ray, the background is rendered instead of alpha channel:

enter image description here

Is there a way to have a "glass" material with reflections of an env map, light passing through and alpha channel through?

$\endgroup$
7
  • $\begingroup$ Well, thanks @RayMairlot, this should have answered, but only partially (see my edit). $\endgroup$
    – Polosson
    Jun 3, 2015 at 11:46
  • $\begingroup$ @Polosson I realized that, and edited my answer with another solution which should answer both this question and the other, provided I understand correctly. Have you tried using a transparent shader? $\endgroup$
    – gandalf3
    Jun 3, 2015 at 11:47
  • $\begingroup$ Well, thanks @gandalf3, I tested your second solution with not much luck. And yes, I use a transparent shader, mixed with glass shader by a "light path" (as shown in the screenshots). The problem on your solution is that with the Fresnel node it doesn't work... May be an angle of camera view story... Thanks anyway! $\endgroup$
    – Polosson
    Jun 3, 2015 at 11:52
  • $\begingroup$ @Polosson Are your windows made of 2D planes? Try using the Facing output of the Later Weight node instead. $\endgroup$
    – gandalf3
    Jun 3, 2015 at 11:54
  • $\begingroup$ @gandalf3, no more luck with the Facing output of Layer Weight. The blend setting swaps from one situation to the other (reflexions and no alpha / no reflexions with alpha). I tried to play with Light Path to drive this blend setting, but no combination works. $\endgroup$
    – Polosson
    Jun 3, 2015 at 13:18

1 Answer 1

14
$\begingroup$

By mixing a glass or glossy shader with a transparent shader based on a fresnel node, rays will be allowed straight through the glass at smaller angles of incidence, and will reflect at grazing angles. Rays which go through and reach the environment background will give alpha transparency:

Note that the Fresnel node is not necessary for mixing (setting the factor directly will get something like what you are looking for), but it does make the reflections of the material behave in a more physically based manner.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.