Mask Out Water?

Hi all.
I posted my issue under the ark modding section.

But since this is more a general UE4 issue. i hope i get more luck in posting here.
I made a small test boat for ark and i was woundering how i can mask out the water in my boat.
looks like a sinking boat. :stuck_out_tongue:

Any ideas, workaround ?

Yea it does :smiley:
Dunno if it’s gonna help but if you enable collision on your boat or on the water? Seems like now they are merging and collision may not let that happen. Just a thought…

That wont work :wink:
You could try this:
in your water material you have to use a node which is called “depth fade”. With that you can choose the opacity of your water material depending on the depth -> so set the depth to a low value and change the opactiy to nearly invisible. () This method is used to simulate “shore effects” and other things.

But depending on your level it will also cause problems when you do it like that -> the water directly at the coast will also be nearly invisible when you do it like that -> so you will have to create pretty steep shores

Saw a post a couple of months ago similar to this, they were creating a submarine game and had the same issue. Somehow with custom depth or something they managed to make the water not render if inside that particular volume, think they got answers from the same guys that worked on Bioshock infinte with the same issue. Search around the forum for something about that.

That’s the first thing I would personally try :smiley: It was just a thought as I stated :stuck_out_tongue:
I really like posting on such problems for 2 reasons:

  1. I keep them as a file
  2. I tell solutions I would try(if they’d work) and in the end the best solution comes(yours mostly :D) and I see what I thought wrong.

Thanks for letting me know!

Thanks for your reply guys.

Emomilol1213 are you refering to this ?
https://forums.unrealengine/showthread.php?45049-UnderWater-Question&highlight=submarine

Seems like a lot of work and the solusion does not seem like a good one for Ark. (i dont want to make a tc mod, just a standar stackeble mod).
Im just going to make a new boat instead. One where everything is above the waterplane. :stuck_out_tongue:
Anyway thanks guys.

You could use custom depth but it would require splitting the inside of the boat to be a separate mesh since you can only change customdepth per mesh. otherwise the water won’t draw over the outside of the boat either and that will look like the boat is floating. Once you have that, you just check in the water material if the pixeldepth is greater than the customdepth and if so return 0, otherwise return 1.

There’s a good thread on this exact situation: https://forums.unrealengine/showthread.php?54733-Is-this-possible&highlight=displace+water.

Any lack with a tutorial on masking out water from a boat ?

1 Like

This is perfect, still have one issue though. i need the “affect terrain” turned on is there a work around for that?

1 Like

This depends on the water.
Transparent materials come with a sort priority.
Non transparent materials do not. And you can only mask them with stencils.

A catchall is to create a boat mesh that has 2 separate hulls as 2 separate meshes.

The outer hull is under water and affected by the waves etc.

The inner hull is stencil masked, so water is never drawn on top of it, giving the illusion to be “dry”.

If you make the mesh right you’ll really never norice anything wrong until you purposuly try and sink the boat.

To sink the boat you have to parametrize and change the stencil value that the water material uses to ignore.
Or, in c++ you can setCustomDepthStencil to change the value of the mesh itself which when it works is a little cleaner of a solution

This disables a fundamental function of ocean water body (“affect terrain”).
Which is a very big trade off unless you’re doing that anyway.

1 Like

I agree with you but I have realised that this is so far most reliable way to do this because of:

  1. When you run fluid sim on ocean surface that is affecting terrain there’s annoying problem when water surface starts to go down the drain during the simulation. That’s why I keep my ocean level fixed.

  2. I’ve got FAQ from customers with some models of AMD graphic cards that ocean surface is looking like a glitch when I was doing hull masking with realtime scene capture. This technique works on every platform, even in VR.

  3. With distance fields you can easily generate coastal waves and ripples.

  4. I’ve got better frame-rates by using distance fields instead of realtime scene capturing especially when you have a lots of boats in the scene.

  5. I prefer to make my own terrain instead of being limited to water brush manager.

1 Like

Hi Artefix_3D,

I followed this tutorial and I got it (almost) working for me.

My Problem is that the inside of the boat is not completly masked somehow.
Almost everything of the ocean is masked except for some kind of details from the gerstner waves and the bright top reflaction of the waves passing by. Those are shimmering through as you can see in the image.

I tried several stuff with the Material Instance, also disabling a lot of stuff like foam, caustics, even shadows etc. Also checked it in unlit mode.

I also checked the Water Material but after the masking MF only stuff comes that I have disabled in the material instance

Any ideas? :slight_smile:

Has to be a less than optimal stencil value used for the mask.

Are you doing any math to the output when isolating the stencil?

Also, to do double shell you normally need 2 shells. I only see one…
So thats confusing.

The inside of the boat mesh is the one that goes in the stancil.

The outside is left alone or it will look as it kind of does floating in air rather than in water…