Create a collision between rock and water (river)

Hello everyone, I have a quick question for you because i’m learning UE4 (4.25). I did a river for a school project. I just applied a water shader that I created on a Spline.
There is many rocks and I wanted to create a “collision” btw water and rocks.
Here’s a picture, the water go straight through the rock.

Is there a solution for the water to be diverted by the rocks?
(Sorry for my bad english I’m french, I hope you will understand my question).

Thanks a lot !

A common technique is called “flow mapping”. I’m not very familiar with Unreal specifically, but it looks like there are a couple of tutorials out there. Maybe someone else can recommend a specific one better than the rest.

Cheers,
-Jon

1 Like

Thanks a lot, I’ll try, it’s very interesting !

I tried all the things. The big problem is that I have a simple material of river so I have absolutly no idea how to use this one and paint on it T.T In the tutorial they used an Texture Object.

1 Like

Hey,
So Flowmaps are basically UV coordinates, that, due to how they are colored, distort the texture. If multiplied with time, they will “move” according to their direction (which is represented through the color value of the flowmap texture).
The first video that aarku postet, shows how you set up a Tool, to paint on the mesh to create a texture that you can use in your water shader. And then you can save it and use it as a regular textureobject/texture sample in the water shader. Though, I like this video from Simon more than the one from Lous: https://www.youtube.com/watch?v=tEr3NE_XLbc
Personally I think the flow map can yield great visual results, but are pretty finicky to use and set up.

Just to show you some more approaches: You could also use Mesh Distance Fields to achieve this, without the needing of painting, but it needs to be enabled for the whole project and eats performance. Here is an tutorial: https://www.youtube.com/watch?v=QABi9T34b_k

I recommend trying to blend between the “flow speed” with vertex color. It is probably not the perfect result you want, but imo gives enough illusion for it to work. Especially if you also use it for some other effects like WPO or a foam layer, which sells it mostly.
Here are some examples that I threw together right now, though I recommend giving the mesh higher vertex resolution, for a more smoother effect.

https://imgur.com/a/kaPQoeU
2021-02-17 13_36_52-UpsideDrown - Unreal Editor

You can do to things in the material, Lerp it or multiply it. Here are to node setups I used in the example above:


.

I can totally understand to use another technique like using flowmaps, for a more realistic look. But I still hope this helps :slight_smile:

3 Likes