Reactive Waterfall in Unreal

ezgif-4-b167bd873a
Hey everyone, I’m working on a waterfall asset that can dynamically interact with actors in the scene as an exercise. I will track my progress here.
This asset can take arbitrary mesh as input (as long as it has decent UVs) and generates foam from nearby actors as well as from slope change, that foam is saved onto a render target and reused with another material for final rendering.

All simulation is done on a shader and a 512x512 render target:

RT

Next steps:

  • Improving foam appearance. Some advice here would be welcomed!
  • Letting the blueprint automatically add splash particle emitters where it overlaps with mesh components.

Feedback, questions, (and compliments) are very much appreciated : D

23 Likes

Here to give compliments!! Very cooool Mohandish!!! :muscle: :muscle:

1 Like

Haha thank you for the compliment :bowing_man:

1 Like

How’s the drawing on the render target done, is it via depth seen from above or some other method?

I tried that setup first but found it extremely limited. Mine works on any mesh with proper continuous uvs, not just a flat surface.
Here’s a general overview of how it works:

I lay the model flat so that it fits in the scenecapture2d field of view, it has a material that reads foam density (red channel) and foam age (green channel) from the render target, runs a simple simulation step that blurs and advects those two channels in the direction of flow. This gets composited into the render target again, then used as input for the final water material.

This setup also takes into account the angle at which the foam accumulates. If enough “fresh” foam accumulates at a steep angle, that means there’s either a sudden change in slope or an object that should block the flow of the falling water.

I’ll post a breakdown sometime after I’m satisfied with how it looks.

1 Like

I see, pretty clever to use a multi-step process like that. What creates the initial foam density and age? Meaning the first step of the simulation. Or does it just accumulate over time, so that the first few frames would always be empty (?)

Thank you! Yes that’s exactly right, although I guess the contents of the render target could be baked for assets that are visible when the level loads. Or just have the render target be written to a few times at the start of a level

I see :blush: it’s a really cool technique, gives me a few ideas. Thanks so much for sharing! edit: also this shit looks really good in your video :eyes:

1 Like