Originally posted by Arnage
View Post
Announcement
Collapse
No announcement yet.
Is this possible
Collapse
X
-
Epidermium replied
-
EGNYTECH repliedOriginally posted by Arnage View PostThe alpha blend tends to work good enough at an angle, but straight on you might need something more indeed. That dying light example is an interesting approach. A bit dark, but that wouldn't be a big issue in your case as your scene is quite dark anyway. I couldn't resist to prototype it a bit, here's a material function to create such a mask that you could use in the glass material of your helmet to create a similar effect:
[ATTACH=CONFIG]23695[/ATTACH]
Leave a comment:
-
Onoa repliedOriginally 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.
Last edited by Onoa; 07-29-2018, 05:24 AM.
Leave a comment:
-
Arnage repliedOriginally posted by Onoa View PostUsing 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 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.
Leave a comment:
-
Onoa repliedUsing 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,
Leave a comment:
-
duke22 repliedThis is relevant:
https://en.wikipedia.org/wiki/Underw...t_diagram3.jpg
The same article states the visibility distance in clear ocean water is 74m.Last edited by duke22; 01-24-2018, 02:15 AM.
Leave a comment:
-
som3on3 repliedOriginally posted by Arnage View PostThe alpha blend tends to work good enough at an angle, but straight on you might need something more indeed. That dying light example is an interesting approach. A bit dark, but that wouldn't be a big issue in your case as your scene is quite dark anyway. I couldn't resist to prototype it a bit, here's a material function to create such a mask that you could use in the glass material of your helmet to create a similar effect:
[ATTACH=CONFIG]23695[/ATTACH]
Leave a comment:
-
svivanco repliedOriginally posted by xnihil0zer0 View PostRyanB covers it above, but here's a quick example of how to do it with one volume. Assuming a water plane at z=0, This projects a plane, perpendicular to the camera view, 10 world units ahead. Then it checks if the intersection of each view ray and this plane has a z value less than 0. If it is, the post process is applied, if not, it returns scene texture. If your water plane material has some z world offset then check the intersection z value against that.
[ATTACH=CONFIG]79052[/ATTACH]
Leave a comment:
-
xnihil0zer0 repliedOriginally posted by Nsomnia View PostThis is something I've had trouble with other than using 2 post process volumes that meet at the middle around the character/boat/etc.
- 1 like
Leave a comment:
-
Komahz repliedThere is a way to "cut" the post process material too see half underwater? Like this?
Leave a comment:
-
KhenaB repliedThe main reason why i'm trying to find a better solution to how i did it is that i had to switch to a tiled underwater terrain with world composition, initially my water surface was sitting at Z 0.0, world composition doesn't allow me to lower my terrain so i had to re-do my entire coding and raise my entire scene to match the new height, the whole absorption post process had to be re-adjusted to really high values since my surface is now around Z 55,000, being able to mask the effect would look much better too
Leave a comment:
-
Arnage repliedOriginally posted by KhenaB View PostNot exactly, the method in post #71 is similar to what i use right now, when in the suit with head above the water surface i can see the underwater part without the effect, when under i can see the ship's interior with the effect, this is happening because i can see both underwater and above water when floating at the surface
I wanted to know if it would be possible to have the effect rendered at all time (or at least slightly above the surface to cover my helmet) but mask the effect from being rendered inside my ship, so that when floating at the surface i can see both the underwater part and the ship interior like they should be
@RyanB, i'm going to have to re-read that a couple of times, i have used masks in the past to mask out materials from being rendered in specific shapes and locations and was wondering if a similar approach could work, i'm not very good with maths so it might take me a while to understand what you're trying to explain
Thanks
Leave a comment:
-
KhenaB repliedOriginally posted by ArnageActually the implementation I posted before already handles this. If you go back to the full post process shader in post number #71 you can see I added a part that limited the influence to only affect surfaces below the water level.
Is that what you meant?
I wanted to know if it would be possible to have the effect rendered at all time (or at least slightly above the surface to cover my helmet) but mask the effect from being rendered inside my ship, so that when floating at the surface i can see both the underwater part and the ship interior like they should be
@RyanB, i'm going to have to re-read that a couple of times, i have used masks in the past to mask out materials from being rendered in specific shapes and locations and was wondering if a similar approach could work, i'm not very good with maths so it might take me a while to understand what you're trying to explain
Thanks
Leave a comment:
Leave a comment: