*EDIT*, doh, I accidentally replied when looking at page1 of this thread. Somehow I missed all the other posts talking about this problem. The below approach would be for a case where the water was a real plane being masked by a box mask in the world. It would build the lip into the water material rather than on another window mesh.
It is possible but kinda tricky since you need to "project" your plane mask forward by solving the right triangle defined by your view vector and desired water lip height.
To solve the triangle remember that a^2 + b^2 = c^2 where c is hypotenuse. Can get hypotenuse length for a unit vector side by doing dot(cameravector,PlaneNormal). Then you get the slope by doing a/b (aka rise/run).
Then the forward extention amount is simply lipheight * (1/Slope).
So you keep your current mask as the Lerp alpha between top and side water. Then you use the larger projected mask to cut out beyond the water lip.
To define the normals of the lip you could Lerp between two vectors, an upvector and the normal of the inside of your glass pane, using the distance between the original mask and extended mask.
This will only work for when the view is above the water looking down. Solving the other case is also possible but requires a bit more work that isn't coming off the top of my head.
Announcement
Collapse
No announcement yet.
Is this possible
Collapse
X
-
KhenaB repliedDo you think it would be possible to mask the absorption effect, right now i rely on lerps to fade the effect when i get to the ship interior, the main issue is being able to see both the underwater and the ship's interior when inside the suit and standing half way underwater, the only thing i have been able to do was to lerp the turbidity distance depending on my height, and make the distance far enough so it wouldn't affect the ship's interior but still hide my underwater terrain
I doubt this is possible but it doesn't hurt to ask
Leave a comment:
-
KhenaB repliedThanks Arnage,
I did not know about the separate translucency, my water plane now blends with the effect
About the kite demo, interesting, you have a sharp sense of observation, the effect is quite subtle but it looks good, at first i thought it was the already implemented sun shafts from the directional light but remembered that those are dependent on the camera orientation? I wonder how performance heavy they are, some of the effects in UE4 are requiring that you have the scalability settings set to high or epic
Leave a comment:
-
Arnage repliedYou can selectively toggle whether a material should use separate translucency. (It's on by default)
In this case you should be able to toggle it off for the water surface, as well as any other material that should be affected by the post process material, to get the result you want.
Btw. you are right that this blend seems to have the same effect as using "before translucency". Using that is probably more efficient than doing the blending in the post process material. (Selectively toggling separate translucency on and off also has the same effect in both cases)
Regarding god rays: these are indeed caused by the waves. I believe you already had caustic patterns in your lighting. Underwater god rays are basically the interaction between these caustic patterns and particles in the water. The absorption effect I posted assumes a uniform light distribution as it's is much cheaper. However, there are many ways to fake god rays in a cheap manner. The current build-in effect is a cheap and effective approximation as long as you are looking at the light source. More correct ones that are also visible when looking away from the light would be a little more complex.
Looking at the kite demo you can actually see them in the final scene in the cave with all the kites, which seems to indicate that Epic may have implemented a system for those in 4.8. So you could wait for the 4.8 preview to be released to see how they pulled it off or implement your own system right now.
Leave a comment:
-
KhenaB repliedArnage,
Concerning adding the separate translucency manually, i have noticed that it gives me the same results as setting the material to "before translucency"
It makes my translucent helmet glass render over the PP effect but all the other objects in my scene too, some of them needs to be rendered below the PP effect
Could it be that i missed something?
For example, with your trick my helmet is now fine, but the diving water surface isn't affected by the fog anymore
With separate translucency:
Without separate translucency:
Thanks
Leave a comment:
-
KhenaB repliedI was thinking about adding even more details to the scene, and crepuscular or god rays would be an amazing addition, and since you have already implemented light absorption, wouldn't it be possible to use that to make some low cost god rays?
I don't fully understand how water and light interact with each other, but i assume that god rays are there because of the wavy water surface, making light penetrate unevenly?
I'll try to find some papers on that subject and see if i can come up with something
Leave a comment:
-
Arnage replied -
KhenaB repliedArnage,
A quick question regarding the light absorption effect
To get good results i have to set the effect to "before tonemapping", setting it to "before transparency" isn't properly blending with the translucent objects in my scene, but i want my helmet glass reflections to be drawn over everything in my scene
Is it possible to draw the reflections of my helmet glass over the post process effect while keeping the post process material set to "before tonemapping"? Even with a high priority sorting the post process is always drawn above translucency
Thanks
Leave a comment:
-
Arnage repliedOriginally posted by KhenaB View PostHowever increasing the Distance Factor caused the effect to be scaled out of proportions, when looking down, the diffusion radius is too small for its distance now, it appears very narrow
I guess the main take away in all this is: real life is almost never linear
Leave a comment:
-
KhenaB repliedThank you for the explanation
I have increased the Distance Factor of the Turbidity Diffusion, my ocean is really deep and it turned dark too quickly, it now matches the depth of my ocean pretty well, this is not real life accuracy but it looks right for my scene
However increasing the Distance Factor caused the effect to be scaled out of proportions, when looking down, the diffusion radius is too small for its distance now, it appears very narrow
Last edited by KhenaB; 04-09-2015, 02:51 AM.
Leave a comment:
-
Arnage repliedBtw. the easiest way (at least for me) to better understand the math of a shader is to not only look at the effects in the viewport. It's math, so just throw it at a graphic calculator or wolfram alpha and it becomes a lot easier to understand what is happening.
As an example, here's a plot of that linear falloff compared to an exponential one:
This directly shows why a linear falloff causes a harsher transition.
Leave a comment:
-
Arnage repliedThat works, the only thing I would recommend is using an exponential falloff instead of a linear one. I adjusted it to this:
Note that I also inverted both the top/bottom and distance effects. As this allowed me to replace the lerps with multiplications. Not really necessary, but it works a little more intuitive.
Edit: We seem to have posted at the same time. That too steep falloff you mention is probably caused by the linear falloff I mentioned here so I may have answered your question before reading it :PLast edited by Arnage; 04-08-2015, 04:53 PM.
- 1 like
Leave a comment:
-
KhenaB replied
Leave a comment: