Refraction: translucent surface not refracted right through other translucent surface

Hello,
I have an issue concerning refraction through a translucent surface. In my scene, I have two translucent elements: a window and a translucent balcony pannel.

As long as I do not apply any refraction to the material of my window, everything looks okay, like here:

But I get a big issue when applying a refraction to it: the balcony pannels that we can see (white-yellowy elements) do not get the same distortion as the opaque elements.

Issue is for instance really visible on the left, where the translucent plate seems out of the hole it is placed into…

Any ideas if there’s a way to correct this?
Thank you very much!

Hi Renemoy,

Would you be able to post a screen shot of your material setup for your refraction? This would probably go a long way in helping others give you some feedback to resolve the issue.

Thank you!

Tim

Thanks for your answer. Here’s a pic’ of my Material setup. Refraction network was copied from a ue4 demo material. But even taking a simple output of the diffuse texture does give me the same issue.

http://pbrd.co/1hFbkgR

The other material is for the moment a simple translucent material with just a diffuse and a value (0.9) for opacity.

This is a limitation with the way refraction is implemented - it basically makes a copy of the underlying image and then distorts it. In order to avoid multiple copies so that we get good performance, only opaque materials can be refracted properly. You can implement refraction yourself in a way that works properly with other translucency with SceneColor lookups, but each mesh using that will cause a copy of the entire scene color buffer, which can add up quickly.

Thank you very much for the quick answer.

Could the limitation be overpassed in future editions of ue4 with a possibility to switch refraction of other translucent elements on/off on a specific material? I think, for some very specific maps it could be something great. But maybe it would add up too quickly?

Anyway, I’ll use SceneColor lookups. Thanks!

Sorry to reply to such an old thread. Would it be possible to explain how to manually implement distortion with SceneColor lookups? Could you provide an example, DanielW?

I would like to know this too.

Hi,

A solution would be to write a custom bit on the stencil mask and use it as a test in a refraction post process material :

  • Enable custom depth stencil pass in project settings.
    1.png

  • Duplicate translucent mesh, setup an opaque material, and in the actor render settings, disable render in main pass and enable write custom depth value (here is set first bit so value = 1).
    You can check custom stencil value in viewport using buffer visualization.
    1.png

  • Create a post processing distortion effect (here a basic noise on the screen UV), and enable and setup stencil testing.

Hope this helps :slight_smile:

Edit : Actually, this is quite limited, since we don’t have access to translucent object normal at the post processing time.
Using a sceneCapture2D and a render targets as a custom pass work. (It’s pretty straight forward at least with a standard camera).