Abusing UE4's Reflection system for cheap translucency

I’ve been playing with this idea to use UE4’s reflection probe system for transparency. Essentially, you should be able to sample reflections via the camera’s direction, rather than the object’s normal, to see “straight trough it”. Obviously not good enough for a big glass pane, but it could be used for some cool Visual Effects, such as a “predator” like effect.

Here’s the proof of concept I put together in Unreal Tournament, by changing the player’s normal to be the camera vector. The results are promising!

[ATTACH=JSON]{“data-align”:“none”,“data-size”:“full”,“data-tempid”:“temp_126537_1515339227970_542”}[/ATTACH]

Here’s a video of the effect in action:
https://twitter.com/Stabberthomas/st…13084227325952

This is the effect I’m after:

And a video:
https://twitter.com/Stabberthomas/st…35297089695744

But this is just using a static cubemap.
Over the next few days I’ll try to implement this as a proper shading model!

Let me know if you have any tips or comments in general.

1 Like

@LegendreVR Maybe! You can use a material where you bend the normal away from the camera to simulate the effect (refraction only) to test it out.

@RRe36 That’s right!

Working on a little playground scene to test stuff out in.

@stororokw Your images don’t work, can you try uploading again?

The shading model does refract and reflect at the same time, and you blend between these. (in this case via Fresnel)

This screenshot demonstrates this.
The fact that the player does not refract in it is one of the biggest flaws. Perhaps this could be enhanced using a similar approach as capsule shadows.
The “thickness” thing I do not understand, what do you mean?

You could use the normal to simulate the rays passing trough for the shadow.

Nope, thats the issue. In the shadow pass it outputs the player camera :confused:

In the first place thank you very much.

I still get the same result with ViewProperty (even that in the description says otherwise, dont know if Im doing something weong or its a bug), it doesnt seem to change in the shadow pass. The only way I can get something close is with the transform view, but that way I can only get the camera forward vector.

Hello.

If anyone is still thinking about this 5 years later and with UE5\substrate already out, I managed to - back in ue4 - obtain a reflection vector that samples the cubemap to look like transparency with this method:

Obviously right now the reflection is just flat, but with some tweaking of the normal it should be possible to fake a credible refraction. Roughness can then be used just as you would for reflections. A clear coat material could be used to also have proper reflections on top of this, I guess.

2 Likes

This is exactly what I was looking for, thanks! I put it to great use in 4.27 since I was having sorting issues with multiple transparent meshes, and the performance gains are important.

The technique can, of course, be combined with masked materials or even masked with temporal dithering, though I’d say only in rather specific use cases. It should work very well on splashing water streams/droplets and other such particles, for example, and it definitely works for my stylized water splashes. No transparency sorting issues, more detail can be packed, and it plays very nicely with mobile and such use cases.

I tested this in 5.5 out of curiousity.

With reflection probes and SSR disabled, it appears to work identically to 4.x.

With hardware raytracing, it works hilariously well. Of course, there’s probably no use case for this over just using regular or ray-traced transparency, but the option is there lol. It breaks at a sharp angle, and I didn’t tune the ray tracing distance properly.

I just managed to test it on Lumen (software) as well. I disabled screen traces, and had to disable “Affect Distance Field Lighting” on the mesh, otherwise its SDF will show up in the Lumen scene representation. It’s another weird edge case, but maybe someone manages to configure Lumen to perform well enough that tricks like this are beneficial.