Depth-masked refraction

User avatar

PostSun Nov 19, 2017 7:20 pm

SF 1.38 introduced a UV input for Scene Depth , so it's now possible to "easily" mask the refraction to avoid some artifacts.

without depth mask, objects in front is refracted

with depth mask, objects in front is not refracted

While there are still some small artifacts, it's way less noticeable than before.

First we need to get a corrected UV, since the refraction will distort the default Screen Position :
To do that, just subtract the refraction from the scene uv

Now we will make 2 different masks, one with refraction and one without:

And finally, we blend our refracted and non refracted transparency, using the mask:

But nothing is perfect, since we can't use the Opacity output, we have to do the blend manually to get the expected result.
User avatar
Location: Hell

PostSun Nov 19, 2017 8:43 pm

Thank you for this.

Return to “Guides & Tutorials”

Who is online

Online users: No registered users and 1 guest