Download

rendering water for boats…

Hi – to start…I’m using Theokole’s excellent Physical Water Surface
…and UE4.16.2 …and forward rending for VR

My problem is I can’t decide between Masked and Translucent material blend modes.
I need some of the features of both…particularly stencils and decals.

Can I decal a Translucent material?
Or… Can I access stencils from a Masked material?
…both are ‘no’…as far as I know

I sort of understand these features can’t be rendered at once….
But, is there some way to make that happen? …a work-around?

For my purposes…the ideal water shader would have…

  1. stencils
  2. decals
  3. dynamic shadows
  4. depthFade translucency

scrn_1.jpg
two water shaders side by side: left, masked blend mode…right, Translucent blend mode

scrn_2.jpg
depthBuffer stencil, used to mask-out water from inside hull - Translucent blend mode

scrn_3.jpg
bow wave decal and dynamic shadow - Masked blend mode (the only problem here is the water passes thru the boat - because there is no dBuffer stencil available)

This is an attempt to render a decay on translucent…
There was an old suggestion on this topic - The idea was to project the decal onto an opaque proxy mesh (green mesh below) and then hide the proxy somehow.
There are a few ways to hide the proxy, below is using the renderInMainPass flag.
But it hides decal as well… :confused:
It makes sense that it would - but it doesn’t offer a obvious solution to this particular problem.
Also…hiding the decal-proxy-mesh using opacity in Masked blendMode also hid the decal.

scrn_4.jpg
…the decal is the foam trail in the water. It is visible while the proxy is visible…
70826e59e9c7c1114efcd8bf7564fd673f9392f8.jpeg
FYI…the waterShader beyond the highlighted square uses opaque blendMode and accepts decals.
The water inside the square(under the boat) uses translucent blendMode and does not accept decals…but I want it to of-course :wink:
The idea of having two shaders like this is like an LOD…the outside is cheaper to render and doesn’t create artifacts at long distances.

Hi cake_,
Do you want to share how you got the bow waves and the translucent Physical Water Surface?
I am trying to achieve the similar thing…

Would you be willing to go into more detail on how you masked out the water that clips through and within the boat?

Hi Wzrd10 - actually…I haven’t been able to get the bow wave decal to work on translucent water.
…decal rendering uses the depthBuffer (as far as I understand) and translucent objects are not included in the depthBuffer. (?)
So I think that would take some major gymnastics to work - but it would be a very cool option :wink:
But decals will work on Opaque and Masked (blend mode) water materials.
Physical Water Surface is Opaque by default…so it will accept decals.

This is a bit more detail on the effect itself…

scrn_6.jpg
decal shader WIP …there is a basic panner to move the foam txtr uv’s hidden on the left

scrn_7.jpg
foamy water?

50d16ce5656ea17e0457011252c29f10af1ab447.jpeg
boat shaped alpha mask…this will get reworked …the shape of the mask has a big impact on how good the effect looks

…add a “Deferred Decal” actor to you’re scene, parent it to your boat, associate your decal shader, size to fit
…also, use the ‘details>rendering>Receives Decals’ flag in your boat model to remove the decal effect from the boat itself

FYI this is the decal tutorial I refer to…

Hi ConceptualTrap - I will post details soon - sometime tomorrow.
But this is the tutorial I used to learn about stencils…

https://www.youtube.com/watch?v=rL7VUeZzRyQ&vl=en

Rodrigo’s tutorials are really excellent.
The tutorial covers many topics which you won’t need for a water mask…but pay attention to the ‘SceneTexture’ explanation.
The material ‘SceneTexture’ node can be set to output ‘stencil’…and you can use that stencil as an opacity mask in your water texture.
You will need to set a flag on your boat mesh component to generate the stencil.

Hey cake_,

Were you ever able to come up with a solution for doing both the decals and the masking in translucent water?

Hi cake_,

did the Decal solution work for you? Any Update?