Transparent background rendering problem

Hey

I have a problem. I want make my own background in photoshop.
When i render my scene in cycles with the transparentbox checked under Film it works fine in the background. But where there is glass, are the background still there.
I cant just render the glass as a transparent shader because i need the reflections in the glass.

How do i fix that??:frowning:

In Yafaray when you enabled transparent background it works fine sƄ only the reflections are there.


I cant seem to find a solution, only method is to use a mix shader with a glossy or glass shader, and mix it with a transparent shader.

You need to ā€˜askā€™ Cycles render for just Diffuse and Glossy parts. You do not need Transmission rays in the mix: they bring initial World image through the Glass to the Camera.


Here Monkey (not Suzanne this time) is set to World background for the render of Cube with hole and glass in it. What is left on render is just a reflection. While iā€™m not quite sure what will happen to the Alpha, this render seems to be more useful you, anyways.
Could be you need to set Transmission rays to Alpha, idk.

Edit: you could render just reflections and compozit over; not letting transmission render could leave interior out.

For glass windows the best solution I have found is to simply mix glossy and transparent. It gives the best of both worlds: very fast, has controllable reflections and allows light to pass WITHOUT caustics enabled.

@kesonmis: Totally agree, but you canā€™t use fresnel as mix factor, you have to make a custom blend using some factor of layer weight/facing. I typically use facing to the power of 5, minimum 0.04 (based on the 4% rule).

Thanks for all your answars.

Eppo: Thanks i tried that solution but it want get transparent. Did i miss something. How do i just render the reflections and compozit over and stil see the interior??

CarlG: How would you mixnode factors looks like? Just 0.04 in the factor or other?

That will take one more exploration session for sureā€¦ Iā€™ll see if i can make something upā€¦
But seems i have gotten the idea right: you render house using one environment image and try to combine on another? Transparent windows show old environment which you would need transparency instead?
Guess, obj or material mask and some color mix mode where black has no influence but the rest is Addedā€¦ Which leaves for what to do about interiorā€¦

@lucblend: Note that Iā€™m discussing usage of ā€œfake glassā€ using transparency (good for window panes) in general, Iā€™m not addressing your ā€œfilm transparencyā€ stuff, as Iā€™ve never had the need to.

Layer weight node @ 0.5 blend, facing output connected to math node (power) with 5 in the second slot, onwards to fac input of a color mixer. Color mixer have white in the second slot and ā€œminimum specā€ in the upper slot (a gray value of 0.04).

This is a typical ā€œgaming approachā€ (PBR), and the catch is this:

  • Real glass using refraction require IOR based fresnel (because we canā€™t make custom refraction node to complement glossy in a PBR fashion) and an actual volume to pass through. Single planes will not work. Refraction based glass is required for frosted glass.
  • Fake glass using transparency require facing based mix (because transparency donā€™t work with IOR based fresnel) but does not need a volume to pass through unless you use volume shader to control tint. Single planes will work fine. Transparency canā€™t be blurred, and blurring only glossy shader tend to look a bit weird.
  • Glass is dielectric material, therefore glass tint should never be controlled with glass color input, unless you fade to white for glossy edge. For tint control, just stick with absorption volume shader. It will be slower, but it will look more right.

Seems that it is possible to render 2 separate render layers - one for each window glass (you seem to have 2 of them, front and back, yes?) and then isolate Glossy (reflection) for each. Combining 2 renders should give reflections+transparency. Could be this is overkill if the back window doesnā€™t reflect much. Depends on your scene details.
Iā€™m having problems with Multilayer exr render output though; while this works for simple 3 object render, resulting image from the actual reflection example is constantly ā€˜brokenā€™, might be a bug or something. Delayā€¦

Thanks CarlG for the great explanation. :yes: I tried det work around with glossy and transparent shader mixed as you suggested and it works very good. :slight_smile:

Eppo also thanks to you for you suggestions. I think for now i would stay with the glossy/transparent material solution. Its more simpel i think and i am not especially good in the compositor :).