Reacting Puddles

Any ideas on how to make puddles that react to other objects like footsteps or cars?

Hey @Danyali23!

I haven’t seen anything like that, something that would react organically to anything that goes through it. Typically, the puddle will be a decal or a water plane, then there will be footstep code (or something like it based on the object) that checks what the object is on. This is how you make footprints in sand, change sound of footsteps, etc. Then when it’s above water, you would have the object create a water effect with Niagara or the like.

I hope that helps!

In short, you make a material that uses render targets.
You make a system that captures whatever is appropriate for the render target, normally flow map style imagery.
Then the material uses the captured render target and bob’s your uncle.

1 Like

Would that create reactions like splashes and such or just reflections?

With a flow map RTV you can get it to react.

Reflections are kinda baked in - even if the engine does them kind of poorly (the built in way), i dont think anything else would ever look much better unless you invest some significant amount of time on the math you need to beibg ibto it for distortion.
May as well just use planar reflections if you want something slightly better.

do splashes with niagara squibs

Thanks for your reply! Since RVTs are updating in real time, wouldn’t that mean a very high performance cost?

It’s so-so.
You aren’t rendering the whole scene, just spot elements - like footprints or similar.
And they are only visible to the capture.
So long as you keep the texture and the writing of said texture are on 1k in pixel size the cost is not a ton.
The more “detail” you add and try to render the more it will cost, like much of everything else.

There are also ways to make it appear to react but cheaper. Instead of caturping the RTV you can directy write to a texture (there is a content example for that).
It eliminates some of the cost - but offers no detail (when you write your writing material is usually just a circle so you can make lines and what not but thats the max detail you can bring).

If you use a properly set up a flow map/vectorfield you can control a lot more.
And you can also levarage distance to nearest surface to make natural flows around rocks for nearly 0 added cost (because the cost is already running the texture, and the item can be forced to write to the texture used to displace the water sheet).

Also, moving vertex around is incredibly cheap - but it is a mostly “fine detail only” ordeal - the further off camera you get the more it is error prone. So you really may want to lerp it down to 0 past something like 40m from player/camera.

hmmm ok, and what about niagara for the splashes. How would you set it up? or fake it?

Thanks for your reply! How would you configure the footstep code? Would you fake the Niagara splashes, or would you make mini-reacting pools?

Probably just use the same texture to start off the emitter by defining highest values or maybe even a dedicated G channel specific output - you don’t necessarily want splashes everywhere afterall.