Realistic Glass in Eevee

(Eric Klein) #1

Creating realistic glass in Eevee is difficult due to the fact that settings are spread out in a number of places and not having good defaults. I also added a custom node to control the direction of refraction and highlights.

Eevee has some limitation with multiple objects, thickness and quality of refraction. The goal here is to have good enough quality for realistic rendering.

Here is example of Cycles rendering of glass from a scene from Definitive Interiors course from @chippwalters.

Using Eevee with a typical Eevee glass shader.

Using Eevee with my custom Eevee glass shader with correct settings.


With this new shader and settings we get refraction through glass and highlights. The thickness of refraction at the base of the glass is much darker. All these improvements matches the Cycle render much closer.

Another Eevee render from a converted Evermotion scene using my custom shader with correct settings.

Tips for creating a realistic Glass rendering with Eevee.

  1. Make cycles render to better visualize glass refraction and highlights to use as a reference.
  2. Screen Space Reflection Settings: enable Refraction.
  3. Screen Space Reflection Settings: lower thickness to “0.1m”.
  4. Screen Space Reflection Settings: trace precision to “1.0”.
  5. Material Settings: Blender Mode to “Alpha Hashed”.
  6. Material Settings: Transparent Shadows to “Opaque”.
  7. Material Settings: Screen Space Reflection to enable.
  8. Material Settings: Refraction Depth to “0”.
  9. Create a Mix Shader node with Fresnel, Glass BSDF and Glossy BSDF. See node picture below:
  10. The Fresnel node control reflection a good range is between 0.5 to 3.0. It is going to vary based depending on the size and thickness of glass. Make sure to start low at 0.5 and increase until the reflection is correct.
  11. The Glass BSDF controls base glass color and refraction direction with IOR. See that is below 1.0 to reverse the direction of refraction a typical value of 0.95.
  12. The Glossy BSDF controls the highlights quality. Base color usually all white and can go above 1. A good value is 1.
  13. Multiple Glass Objects: For the glass objects behind change the Material Settings: Screen Space Refraction to off.

This is a good starting base of Eevee settings for glass. Adjustment may be need depending on the glass type, lighting and scene content.

9 Likes
Realistic ArchViz from Cycles to Eevee (with tips)
(Scott ) #2

Thank you for sharing this @eklein. I have a glassware design company so this is great. May I pm you for a little more info?

(Emir Sinan Gürlek) #3

Thank you for sharing the knowledge on these Eevee topics @eklein , much appreciated. Maybe more will follow after this? :upside_down_face:

(Eric Klein) #4

Scott,
May I pm you for a little more info?

Sure.

(chippwalters) #5

Hi Eric,

Thanks for this.

I was playing around with EEVEE glass tonight, and compared your shader against the one I created at https://gum.co/cwGlass
I see where we both use the metallic parameter to help create a glossy surface. I use a transparent shader while you use the glass shader and I use additive whereas you use the Alpha Hashed mode (I’ve also seen Alpha Blend work well too).

Still, I think it’s a case by case basis and a lot has to do with the lighting and what’s seen behind the glass. Here are two images. The first is using your technique (perhaps I missed something so I included the original cwGlass.blend scene):

As you see, it definitely has a ‘metal’ look to it. (chalise and cylinder and flat table on the right of the scene. The ones on the left of the scene are the old default additive model-- not cwGlass)

Here’s the cwGlass shader

This seems to work better. Here’s the default cwGlass scene. Perhaps you can tweak for your settings. I’m all for a single best glass shader :-). I just don’t know if it’s possible in EEVEE as I suspect it’s a bit of a case-by-case basis.

cwGlass Scene File:
https://filedn.com/lLMW4jXsJqxXkRYjd1UCoKL/Blender/cwGlass-02.zip

(Eric Klein) #6

Chipp,

The realistic glass works great. I made a change to my node setup to make it work with different types of glass thickness and size. I replace the Principle BSDF with a Glossy BSDF. I updated my Tips Settings above with my new changes.

The cwGlass shader is not realistic. I doesn’t do any refraction through glass and highlights are very inaccurate because of “Additive” blend mode and show back face. Look at my Realistic Glass shader it has refraction through the glass, realistic glass thickness and the reflection highlights are realistic when compare to Cycles.

See image below and attach file without the HDRI with is available from your previous post scene blender file.Glass RealisticNoExr.blend (211.0 KB)

1 Like
(chippwalters) #7

Eric,

Thanks for sharing. Yes, you are correct, I need to enable refraction for cwGlass-- it’s such a processor hog and I prefer saving those cycles when doing realtime renders. It really gets my computer singing.

To me, the realistic glass shader is too dark. Looks more like acrylic in the render you show. Not enough fresnel wrapping around the sides. Perhaps it’s the lack of HDRI or just the scene. That’s why I put the curves node in cwGlass, to be able to tweak the amount of fresnel reflection on the object with a single point.

I’ll take a look at your file and new settings.

I do agree that the additive has an issue with NOT having any dark whatsoever. I think your approach may be better, I just need to play with it to see if I can remove some of the darkness. Thanks again for sharing. :grinning:

(Eric Klein) #8

Chipp,

To make glass color lighter just increase the color of the glass shader it can go higher than 1.

Here is a Cycles render. Even here Cycles has issue with cup refraction. Notice the problems that I describe above with the cwGlass compare with the Cycles.

Here is an Eevee render with update scene file with realistic shader with lighter color glass and higher reflection. Glass RealisticLightNoExr.blend (209.4 KB)

2 Likes
(chippwalters) #9

Eric,

Been playing with this all morning. Added a few twists to your earlier, but essentially came up with a very similar look:

This is the best glass I’ve seen so far in EEVEE. Good work.

Ended up pushing the value really high, and adding a curves node to do finally tweaking for the fresnel. I also created a version which can render flat glass planes. This one needs the Transparent BSDF shader.

I learned a lot by looking at your solution. One thing was the Glass BSDF renders refraction, whereas the Transparent does not.

It appears the backface flag does seem to create some ‘dirty bits’ though I’m not exactly sure why. I understand why you adjust the Trace Precsion and Thickness in EEVEE settings, but even if not adjusted, this glass looks good (though obviously Refraction needs to be turned ON or else it does not work.)

If it’s okay with you, I’ll update my free glass shader and rename it ekRealisticGlass (and link to this thread). That way the 1800+ users who have downloaded it can be notified of the new version.

Thanks again. PS… check out the bottle model: Created with 7 vertices :slight_smile:

https://filedn.com/lLMW4jXsJqxXkRYjd1UCoKL/Blender/ekGlass.blend

1 Like
(Eric Klein) #10

Chipp,

I added material for the bottle and jar. Same node setup different settings on the Fresnel node going above 1 which in this case it’s closer to the Cycles render. The way you had it the reflection on the side of the bottle and jar are a bit too extreme.

For the flat glass a put a new material node with same setup with different settings. Realistic flat glass has refraction just not as strong as the bottle or cup. Adjust the Glass shader IOR to 0.99 to reduce the refraction.

It’s okay for you to update the free glass shader with ekRealisticGlass.

Here is the Eevee render and adjusted scene with my changes I discuss above.ekGlassTweakNoExr.blend (1.2 MB)

1 Like
(chippwalters) #11

Good stuff. Thanks again Eric!

Making a REALISTIC Glass Shader in EEVEE - Blender 2.8 - Tutorial