Floating static mesh on water?!

Hey all,
I have been trying to figure out how to get an object to move up and down with a tessellating plane (Water) like these examples :

But I just can’t seem to figure it out! is there a way I can get this kind of floating effect just using blueprints? can someone explain or help break down the process.

any help would be greatly appreciated


These involve using some simple formula for the waves, such as adding together various sine waves. The same exact calculations need to be done in the blueprint and in the material. Then you just sample the position of the floating object using the function and you get the value of the noise. People usually also do a slight time offset at that stage as well so the object appears to lag behind the actual water a bit.

hmm I guess I’m confused on how to get information (a value) from the material or plane, to then feed into the blueprint. I looked at a few tuts but they all seem to leave out huge gaps of how to do certain steps. do I need to use c++?
is there a good tutorial that explains this technique in full? or would you mind elaborating?
if I have a height map can I just use that some how? just trying to figure out the fastest easiest way to make debris floating in water !!

Thanks for the help!

The only value you need is “get world position” from the actors, then perform whatever noise function on that position. There is no getting information from the material.

It will work because in the material you sample worldposition using the worldposition node as well. World positions always match up weather you sample them in blueprints or material editors.

ok so I’m getting the material to “World position offset” with some scrolling textures, using a material function. now I need to “get world location” of the static mesh component in the Blueprint and perform the material function on the location of the static mesh? sorry for not fully understanding. :frowning:

I understand that somehow it all lines up, I just don’t get how to get the same distortion/“world position offset” from the material to the Z axis of the static mesh in my Blueprint.

The item above is something that might help

Here is an example in its most basic form, a single sine wave. Note that I changed the Period of the sine node in the material to be 2pi since that is what the BP one uses.

The water plane material, this is the whole wave function:

There is a blueprint that has a single static mesh. It just adds the wave motion to the mesh’s Z. This also hardcodes the water to start at 0 in Z.

This is the component list, just a mesh:

And as I move the blueprint around, it automatically positions the mesh along the correct Z height:

wow Thanks for the reply!! this is really useful!

just a few questions, what do you mean by 2pi? is that dividing it by 250?
for some reason my mesh didn’t match up to the same wave as the plane.
also im trying to do it in real time. I feel like im close but still having trouble.

thanks a ton!

If you click on the “Sine” node, the property window should show a property called “Period”

For some reason, in the UE4 material editor, the sine node has a default period of 1. That means it repeats ever 1 unit. The theory is that this was done to make it more artist friendly since people expect things to repeat over 0-1. But mathematically, sine has a period of 2 pi (which is 3.14 * 2 or 6.283185).

So you need to make sure to make the material sine match the BP sine. The BP sine uses the mathematically correct 2pi as the period.

I am beginning to think it was a mistake to alter the period of sine… but its kind of too late to change it now since it would affect a ton of content.

changing the period is also the same as simply dividing the input to the sine. So you could also divide by 2pi after the divide by 250 to achieve the same thing.

Dividing by 250 says “these waves repeat every 250 units in the world” which is 250 cm or 2.5 meters. With a period of 2pi, that makes each wave repeat over 250*2pi which is 1562.5cm.

Hey Ryan! thanks for all the help, really means a lot. :slight_smile:

I feel I am super close to getting the result I was looking for I have ran into a problem tho.
the Blueprint and the plane seem to match up their “offsets” but only if they are both aligned at the same location. so when I align the Blueprint actor and the plane up at origin then selected them both and drag them back and forth everything works fine. where things get messy is the I try to use a panner node to move the matriel on the plane , thus making “waves” in realtime. the BP actor does not seem to do anything when “playing”. its seems the BP actor only move when I move it. any clues on how to get the plane waves moving in sync with the BP actor in realtime?

as you can see in the screengrabs below as I move both object along the Y axis both object seem to line up perfectly, so that tell me the contrustion sctipt is set up right but it seem to not move when I press play. :frowning:


That is because in my example I hard coded Z to be 0. Simply replace it to be whatever you want. but you do need to match them up some how either through parameter being set on the material or by just agreeing in your head to always use a certain value.