How to make a gradual transition between two shaders, depending on the normal of the surface against the angle of the view.

The use case is I want to make bubbles of a white, somewhat opaque, liquid. When passing through the center (from the camera) it will pass through minimal liquid so it is most transparent there. When a ray passes near the rim it will pass through maximum liquid and be most opaque there.

I will just mix a transparent and opaque material. If the normal faces the camera, select the transparent material. If the normal is perpendicular to the camera, select the opaque material.

I have tried fresnel but it is meant for items refracting light.

I have tried the normal node but can't get it to work. I think that if I just use this correctly, this is the right way.

I have tried taking the normal of the object, normalize it and dot-product with the camera normal (normalized). It gives the result below. It is in the right ballpark, but not correct. Nevermind that it is black.

preview of material with dot-product mix shader factor

If I reverse the shaders I will get something like a puff of smoke, gradually becoming transparent at the edges.

  • $\begingroup$ What's wrong with fresnal? Does it end up affecting the glass/refraction shader or something? $\endgroup$
    – CharlesL
    Commented Nov 29, 2013 at 20:45
  • $\begingroup$ It's not gradual. It is abrupt. $\endgroup$
    – Gunslinger
    Commented Nov 29, 2013 at 21:56

1 Answer 1


Try using the Layer weight node with the Facing value as a mix factor:

enter image description here

The Layer weight node gives a map based on the angle of the surface to the camera:

enter image description here

When used to mix a diffuse and a transparent shader:

enter image description here


The Blend value controls the blending between angles:

With a low Blend value:

enter image description here

With a high Blend value:

enter image description here

As mentioned by CharlesL you could further control the blending with a Color Ramp node:

enter image description here

enter image description here


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .