Anyone figured a way of doing deformable terrain in UE4 ?
I tried many way of doing it but failed them all
Here is what i did, maybe someone can explore more option or get it to worké
The first thing I investigated is, if landscape vertices could be deformed in real time and could not find any hint of that.
I wanted to do it using a custom mesh but could not find any way to edit vertices position of an object directly.
I tried to write in a texture that i could use in a material to offset vertices or pixels ( the player could fire on the ground and it would “paint” in the map in greyscale value that would be used for offseting)
I couldn’t get it to work so i then tried using a rendreTarget2D, capturing from the top of my scene that would only render some invisible object to the player that would then be used as mask, and lerned that apparently ue4 does not support layered rendering of object with different camera.
Anyone got somewhere ?
I do not know C++ but i do know a bit of C#, still i tried to stay away from it but i think i will have to
If I was to do this, I would most likely do it entirely in C++. By extending the Landscape classes. Creating a new vertex factory based on the Landscape one. Passing it a buffer that contains a mask for offsetting (Modifying the shaders as necessary to make use of it).
Disclaimer, I actually haven’t looked at doing this, whether or not its actually possible, I am just describing how I would approach this situation.
definately possible, and definately only via C++
if I had do do this I’d start by looking at how the editor modifies the landscape when you paint on it.
all in all however, I’d bet it’s not fast enough for realtime using and abusing but I’d love to be wrong here
Wouldn’t simply editing vertex alpha or color of a mesh in realtime would be easier ?
I am quite surprised that nobody seems to have worked on anything similar.
I am really unsure where to start with this, any begginer tutorial on using C++ to make custom class or blueprint functions ? I know i can do it by using and the source code but if there is a simpler way, that would be great.
using vertex color would result in the same as using tessellation: it’s applied in the GPU so the changes would not apply to the collision mesh.
for this to work you need to edit the actual vertices of the landscape mesh, and then either regenerate the collision mesh from it (probably slow) or edit the collision mesh in the same fashion (probably harder to do)
Completely forgot about the collision, that certainly does complicate it then. My theory would only work for visual. As Chosker stated, realtime modification of collision would be harder to do, and may even require significant changing of code (If the collision is cooked)