I want to make a water which can have some interactions with actors. I have got some videos showing that how to make waves. But I want to make the actor trigger the wave. For example, when the actor jumps out of the water, the water begins to have the wave. In order to implement this kind of effect, I think I need to make the material communicate with the actor. But I don’t know how to do this.
Thanks a lot. p.s. Sorry for my English. It’s not my native language.
That depends, what is your water? Is it only a material, a blueprint?
You could make a blueprint with the water and then a On Component Overlap or something like that
The question is, do you want the interaction to be one way or two way. For one way interaction, you can use dynamic material instances to feed vector parameters(like an actor location) and texture parameters(like a material drawn to a render target). For two way interaction, you need a way get the output of a material back from the GPU. This requires C++. It is very expensive, so you need to think carefully about how to implement it. Like, with the original example, does an entire heightmap need to be generated in a render target to do buoyancy calculations? Or can a much smaller CanvasRenderTarget2D(where each pixel is the location of a test point) be used as input into a wave generating material and drawn to a render target of the same size?
If you create a new c++ project, you can use the code from these files to add a render target reader component that’s usable through blueprints. Just change
found in RenderTargetReader.cpp, to:
found in RenderTargetReader.h, to:
This works in 4.13
Thank you for your reply. One way interactive is good enough for me. I find an algorithm for calculating wave, but it needs to communicate between two textures. It will calculate the height step by step, and each step will be based on the result from the previous step. So it stores the height information in one texture, and then calculate the height of the second texture based on the first texture, next calculate the height of the first texture based on the height of the second texture. Can I use two materials to implement this kind of calculation?