Glass Shader - Fullscreen Issue w/ Negative Refraction Values?

Hey all!

I have a really nice third-person variation on the classic marble roller going, and have a really nice glass shader going along with it, based on this tutorial.

I am having an issue with the refraction, however, in fullscreen mode. (Using UE 4.25.4)

Here’s my lovely marble in windowed mode, in-editor. This is the way it’s supposed to look.

And here’s my marble in fullscreen mode - where a large, ugly occlusion appears at the top of the marble.

I am using a negative refraction index of -0.7 as I discovered that it causes the refraction to appear upside-down, which is the expected behavior for a perfectly round glass sphere - as photographers know, a perfect sphere will cause an upside-down spherical refraction.

Are negative refraction indexes supported behavior, though?

The windowed mode looks great, and is the way I’d prefer it to look all the time.

Thanks for any help!

After a bit more research, it appears this bug appears anytime refraction is less than 0.5, and in fullscreen only.

1 Like

“Supported” as in the shader will accept them, sure. But it does scale the effect based on screen properties and these scalings may not provide consistent results without plausible IoR values.
However screen space refraction is not a particularly physically accurate technique regardless of if you are using accurate or impossible IORs. You will very frequently find that it will attempt to sample off screen, especially when extreme values are involved. This is usually the cause of artifacts.
Raytraced refraction will give correct refraction results but isn’t compatible with lumen so the lighting will appear wrong.
You can also write your own custom refraction shader better suited for this case which is probably what I’d do.