Dynamic mesh beam

Hi people,

I’m trying to create a water beam effect that has to push enemies backwards and deal damage. It can have a max range, but if someone is closer than that, the beam needs to end at the character and then push them back.

I also wanted to use a mesh cause of the displacement. But, is it possible to somehow change the mesh length to dynamically adress the distance from the character?

I guess it is expensive and is safer to use a beam emitter, but just wanted to ask if this is possible?

Thanks in advance :slight_smile:

You could have a look at how they made the link gun for unreal tournament. If I’m not mistaken they use a spline to deform a mesh and then add displacement and rotation on top of that.

Good luck :smiley:

Thanks for the reference tip :smiley:

I think i get the point, but in their Link Gun there isn’t really any textures, just color. I will have a water texture that scrolls, so i think physically scalling the mesh isn’t good.

I was thinking if it was a good idea to somehow get the procentage of the mesh length based on where it overlaps with a character. And based on that procent create a opacity mask to make it not visible further than that point.

Don’t know if that is a good idea, maybe it could make problems with the gameplay programming part because of collision :confused:

For visual sake, is that even posibble to do? :smiley:

If you have any other ideas or examples I would really appriciate it! :slight_smile:

subtract hitpointlocation from gunlocation use that to tile your water textures?

i think you can also set tiling on curve meshes since it creates a new mesh for every curve point, so as long as your splines are equal length it shouldnt give much problems

Hey there! @SineVFX did something super cool that I think is what you’re talking about. I thought there was a thread about it in here, but I couldn’t find it searching similar terms.

https://www.youtube.com/watch?time_continue=2&v=jVpVXbh5teE

Yeah, something like that is cool :smiley:

I think i could get away with using a generated opacity mask based on the distance from the effect spawn point to the enemy. By remaping the distance value to scroll a black texture up or down in a range like -1 to 1 for example. I will have a hit effect that spawns at end point of the enemy, and that will hide the end of the beam.

So the gameplay math is done via Line Trace (using UE4), and the mesh beam and VFX is just for graphics sake. The mesh will always be there in its full scale and everything, but the opacity mask will cut out its visibility if needed. My main question about that is, is that a good idea optimization wise? :smiley:

In theory it could work, will try it out and share the result :smiley:

Hi all,

So just to say that this methode works! :smiley:

Cause of NDA I cant show you how it looks, but i can explain what we did.

I wanted to create a waterblast effect, on a simillar principle like the one above, and to make it look good I need to use a mesh. For some UV tricks and Vertex Displacement. It needed to have a dynamic range.

We used LineTrace to project rays from our character outwards in the direction of the Waterblast. From that we can extract the length of the ray, and based on that length, we remaped that value to drive a float variable. This float variable is used to scroll a grayscale gradient texture up or down (Simple UV scrolling like you would do in any trail or something like that) and that is used as a opacity map.

We can also get the start and end point in of the LineTrace, and at the end point we have 2 different types of effects. One for when we hit something and one for when we miss. This is used to hide the cut at the main Waterblast mesh.

It’s nothing special really, just wanted to share this, cause I wasn’t sure if it would work, but it does :smiley:

Hope this will help someone :smiley:

2 Likes