Announcement

Collapse
No announcement yet.

Is this possible

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    Originally posted by Onoa View Post
    Using Arnage's method, has anyone tried to implement underwater refraction for the water surface? I am using an inverted plane from my water surface with refraction enabled so that I can get refraction when underwater and looking up at the world outside of my water body. But it seems that the distortion is not being applied properly and not taking the PP fog into account. I've been trying to solve this for days now but to no avail.

    Here's what I am expecting the distortion to look like when underwater (combined with the fog PP effect ideally, but it's not enabled in this screenshot):

    And here's what it looks like with the PP enabled:

    Any input or pointer would be greatly appreciated.

    Thank,
    The fog calculation is based on an undistorted depth buffer, which causes the artifacts you're noticing. You could fix this by also distorting the depth buffer for the fog calculation, but there is another issue going on that I would recommend fixing instead:

    The fog extends above the water plane, as the solution described earlier doesn't handle looking back up like you are doing completely correct. Often this can be ignored, but in this case it just looks wrong. To fix this you should calculated the fog based on the distance up to, but not beyond, the water plane. If your water plane is flat this can be easily calculated inside the shader. If it isn't totally flat (for example due to waves) you need a more complex solution. For example, you could render the water plane to the custom depth buffer and then take the minimum of the regular and custom depth buffers as the distance to base the fog calculation on.

    Comment


      Originally posted by Arnage View Post

      The fog calculation is based on an undistorted depth buffer, which causes the artifacts you're noticing. You could fix this by also distorting the depth buffer for the fog calculation, but there is another issue going on that I would recommend fixing instead:

      The fog extends above the water plane, as the solution described earlier doesn't handle looking back up like you are doing completely correct. Often this can be ignored, but in this case it just looks wrong. To fix this you should calculated the fog based on the distance up to, but not beyond, the water plane. If your water plane is flat this can be easily calculated inside the shader. If it isn't totally flat (for example due to waves) you need a more complex solution. For example, you could render the water plane to the custom depth buffer and then take the minimum of the regular and custom depth buffers as the distance to base the fog calculation on.
      Thanks a lot for your quick reply Arnage. I was able to fix it by not calculating the fog beyond the water plane, which is indeed flat in my case. Thanks!

      Click image for larger version

Name:	Screenshot_1.jpg
Views:	1
Size:	58.4 KB
ID:	1508281
      Last edited by Onoa; 07-29-2018, 05:24 AM.

      Comment

      Working...
      X