Originally posted by Onoa
View Post
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