1
\$\begingroup\$

I'm wondering if anyone knows some common and efficient ways to do a fast tracer for an instant bullet.

As you can see here, there is a yellow tracer from the soldier's weapon

The orange line coming from the helicopter

I've seen people speak on forums of using primitive lines with DirectX, but I doubt this is up to "Commercial" standards. I also thought of using some sort of minimal prism geometry encompassing the line and using a shader but even then, I'm not sure how to give it that nice glow and fade. I'm obviously not looking for any code in specific, just some ideas in general.

Thanks, Joey

\$\endgroup\$

1 Answer 1

2
\$\begingroup\$

There are billion ways to do this. But here is my approach :

To do this i would go with a more "particle" system approach. Rendering a line is quite easy with a quad, you just stretch the four vertex in the direction it´s traveling and then have a maximum length that it never can be longer than.

the best way with this is that you can heayily optimize this to the GPU and do most of the code on the vertex shader which will be immensely fast. You could even go so far that you just set up a bunch of points that you update on the cpu side. Which would be the point where the bullet is, and then just stretch the "back" vertex´s to the negative direction * length. that would give you a line, then you just have to make sure it´s always facing the camera. With that you can apply textures and other cool effects like heat daze or what not.

This is a very trivial task and should be very straight forward to. Good luck!

\$\endgroup\$
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .