Download

Infinite fluid simulation by render target blueprint tutorial!

Hi community!
Today i will show everyone how to make an infinite fluid simulation by unreal render target and blueprint, base on the fluid simulation in content example project (please download it at LEARN tab, for someone who dont know where it is).
First, open all the render target, for HeigthMap RT, change 3 RT textures like this one:

and for NormalHeigthMap:

Next step, go to ComputeNormal Material and HeigthSim Material, change the constant value of texelSize to SceneTexelSize(this is very important). The value texelSize provided by the content will not work, so please change all of it.

Now, go to Water Material, and add to the UV of HeigthfieldNormal:

For the Heigthfield, i dont care about it because when you do infinite surface, the vertices of the plane mesh will not be enough unless you use tessalation, if you want it, simply add to the
UV of Heigthfield like the HeigthfieldNormal, and do boxmask or sphereMask to increase the Multiply of tessalation around camera position(do not just multiply or fps will be greatly reduced).

Next step is the splat material, change it like these pictures:

Yay, we’r done for the material, now the is time to go in water surface blueprint and make a little change. First, create 2 functions:

1.This one is to pass the value of xy coordinate to splat material

Ok, now is the last part. In tick event, change it like these pics:

DONE! Now i want to discuss somethings about this.
The first one is that, because of the large size simulation (8192), player cannot see the far size that is doing draw tiling, its imposible to see that far, but if you really do not want to simulate outside, you can do boxmask or spheremask around camera position, and multiply the value to the normal output(make sure to lerp from vec3(0,0,1) to vec3(1,1,1), do not use 0 value or the normal will not right).
The second one is, i forgot to mention that you have to change the logic also in the Point Damage event, change it exactly like the one i did in tick event, they are the same, plus tick event modify the splat strength to decrease it overtime, not in point damage event.
And the third one, if you want to simulate > 2 actors overlaping, you should make an array of components and location of there components that are overlaping, foreachloop and draw those to render target.
Finally, here is the result when you do it right
[video=facebook_2017;100004956300407/videos/1237100026465196/]Redirecting...

Goodluck everyone!

2 Likes