Rendering an ACTUALLY transparent Glass? (Cycles)

Hello everybody!
Blender noob here, with a Blender rendering question :slight_smile:
I want to render a see-thru glass with an alpha channel, so that later i could composite it in photoshop/after effects and have the background move and change underneath it. i know the background won’t be refracted (i could fake the refraction in after effects)


I just want those cool highight shapes to be extracted from the sphere without this gray color in the way.
I already figured out that it has something to do with the world material nodes, but i don’t know how to set it up so that the the inside of the glass becomes transparent.

Any suggestions?
Thanks guys!!! :smiley:

Fresnel output gives slightly dark center and fully white edges, meaning that the object will be more transparent at grazing angles. Is this what you want? Normal setup for a glass shader is fresnel to mix refraction (top) and glossy (bottom) in which case what cycles see will be refracted. If you want no refraction at all simply replace refraction with a transparent shader (essentially a thin glass shader). The fresnel can be additionally outputted to a separate channel (i.e. emission?) to recreate the “film transparency” in post (I’m guessing, I’ve never done it).

glass is not 100% transparent , nor is it reflection free

there is always some reflection from the angle of incidence

plate glass is aporox. a 80 / 20 splitter

20 % will reflect off the glass and 8o % will refract through the glass

to be reflection free you need to use polarized light and a polarized filter set at 90 degrees to each other . and even then ???

You can’t have alpha transparency with a refractive material as the glass material is not transparent. It can’t know which part of the image is meant to be shown. If you want transparency, you need to use a transparent material instead, so you may as well use a mix of a reflective and transparent material instead of glass.

1 Like

dont use alpha channel, just use black for opaque, and white for fully transparent. this seems to do about what your looking for?


1 Like

If you’re going to want to photoshop it into a photo, you’re going to want an extra render-layer with the glass sphere with its default material, the other objects with a holdout shader, and with a background pane with Window texture coordinates. That’ll (1) let the computer know where the background is AND (2) pre-compute where in the image to display under the glass, so that you don’t have to distort the image manually underneath the sphere.

1 Like

Hello, i know i’m late but, you can make glass transparent using a chroma. Put all yout Glass object in other layer and in that layer put green, blue or red plane behind the galss and then in the compositing view, use de node “Keying” a select the color and that’s it, you will have beautifull transparent Glass with refracction.

You might considered, that the refraction aren’t the most realistic but you will have a Good Result.

Example:

3 Likes

This works brilliantly. Thank you.

No need for this anymore, Cycles has a native option to just render glass on alpha now:

glass

3 Likes

Even better. Thank you!!

J_the_Ninja this does not proply work… :frowning: it is so diferent than what you can see in preview… :(((((((

1 Like

I have the same problem as @Dominik_Jiruse .
There is no physics-based excuse for not treating transparency properly; and there is no question as to what value to use; alpha is just another value; Also what people are asking for when they ask for this feature is the solution to light rays that do not come from absent refraction sources.

I can get a clearcoat to appear in the strongest region of reflection when “transparent glass” is checked, but nothing else that (absolutely) should be there. This solver is in need of an upgrade. The fact that this could be dealt with in the past with chroma only illustrates that it has been a persistent bug.

That being said, I’ve seen better results than what I’m getting in other peoples’ posts. I would really love to know if this is a problem with my graphics card (which is not supported by eevee), a trade secret nack that people give you the runaround on, or a genuine persistent problem in blender. (LEFT: “Transparent glass” checked on. Right: “Transparent Glass” unchecked. This shader isn’t alpha, it’s transmission set to IOR “1”, fyi; I get better results with “clearcoat” but that shouldn’t be the case, so that isn’t pictured)

Could you post the .blend file for that one? I can’t reproduce it or entirely figure out what your issue is.

And by chance, did you save the image on the left as PNG before adding the background? PNG only supports straight alpha which can’t do a number of comp situations (basically, anything that radiates light without also being opaque).

@J_the_Ninja, thanks for looking into this.

Both images are saved to PNG from the render window with whatever alpha Blender gave them (and with the same visible results in that render window). The images were stitched together in Gimp. I assume the background you see (besides that of the internals of Suzanne on the right) is this forum page background.

transGlassAlphaIssueBA.blend (1.7 MB)

Yup, it’s a straight alpha issue. The reflection areas are not occluding (they keep the transmission alpha) therefore they get incorrectly scaled by transmission if you do the comp as straight alpha like PNG does.

This is why you should never use straight alpha :wink:

If you really need a PNG with alpha for a web graphic or something, you can fudge the data a bit like this:

Unfortunately, there really isn’t another good way to fix this without making the shader less useful when composited properly. Glass doesn’t become opaque just because something is reflecting in it, so the alpha channel really should not be affected by reflections. It just means straight alpha can’t handle it, but straight alpha can’t handle a lot of things. Such as fire, which also shines but is transparent

I am desperately in need of clarification here. From a purely physics-based perspective, when light reflects on (not “in”) an object with some transmission (where full transmission isn’t visible beyond refraction) it reflects in the same manner that it reflects on any surface (“opaque”), When it doesn’t, it doesn’t.

How is this latent (scalar?) value of transmission accessible, let alone useful, to the point that distorting straightforward results is deemed essential? Why on earth would it be doing anything beyond being a factor in solving a ray [properly]?

I’m not a computer graphics science major, nor should someone have to be to use this feature. But I really don’t think that’s the issue. What exactly is your case (or the case of the industry establishment) for the benefit of this type of rendering? You can even use uber-fancy terminology on me, but why on earth would anyone want anything other than “straight alpha” i,e. alpha the only way it’s ever been, a grayscale value determining opacity.

I’m leaning towards my original option of assessment (with significant resentment, but not at you specifically–thank you again btw) …that this is a “a trade secret nack that people give you the runaround on” …

I understand that the controls on the Space Shuttle were split extensively into their many operations giving the crew manual flexibility. I don’t see the flexibility here, only impediment.

Here’s a diagram of why Cycles produces the values it does:

Light from behind the object (cyan arrow) is not blocked by the object, therefore alpha is 0.
Light reflecting off the object(green arrow) does not destroy light coming from behind the object, therefore RGB is the sum total of both light from behind the object and light from the reflection, and alpha is still 0.

Alpha is the % of light blocked by the object. Color is the light arriving from the object.

The “straight alpha” pipeline used in Photoshop and GIMP is unable to handle this situation. It works fine in tools such as Nuke or Fusion (or Blender’s compositor, or Houdini’s) which are able to deal with this.

As for the problems with straight alpha, I’ll let Zap Anderson explain it, as he’s a lot smarter than me: https://community.adobe.com/t5/photoshop/change-in-exr-open-from-cs2-to-cs3-can-this-be-fixed/m-p/1521042?page=19#M918

This is also a pretty direct description of the situation: https://developer.blender.org/T52680#972815

The way you’ve been understanding alpha before is wrong, that just never came to bite you until now. If you need a workaround, I showed a compositor setup that will get the job done.

As a follow up, I want to single this out:

“straight alpha” i,e. alpha the only way it’s ever been

That is NOT the only way it’s ever been, as I hope the 2 Adobe forums comments from Zap (and the rest of the thread) will explain. It is specifically NOT the way alpha was intended to work, it is the way Adobe incorrectly implemented it many years ago and too many people in Graphic Design 101 or Graphics Programming 101 saw the Adobe way first and assumed their mistake/simplification is how it’s supposed to work. It IS NOT how it was intended to work, the way Blender does it is how it is supposed to work. The Adobe way is simply less flexible because it always multiplies your colors by the alpha when compositing them, even when there is no need to do that.

1 Like

Can someone please show images of the problem next to the correct image?

Here are the results of the built in Glass shader in Blender and my “Perfect Glass” shader, is the problem still present in my shader?
Both materials use IOR of 1.0