1
votes

I am still developing on my sci-fi video game using my own custom game engine. Now, I want to implement the combat system in my game and in the engine. While nearly everything is clear to me, I wonder how to do proper laser beams like the ones known from Star Wars, Star Trek, Babylon 5, etc.?

I did some online research, however I did not find any suitable article. I am pretty sure I searched with the wrong keywords/tags. Can you give me some hints how to implement such effects as laser beams? I think, it'd be enough to know the proper techniques or terms I need for online research...

1

1 Answers

7
votes

A common way is to draw three (or more) intersecting transparent planes like this, if you excuse my crude drawing:

1

Each of them then bears the same laser texture that fades to black near the top and bottom edges:

2

If you add any subtle detail, remember to scale the texture coordinates appropriately based on the length of the beam and enable wrapping.

Finally, and most importantly, use a shader that shows only the planes facing the camera, while fading away the ones at a glancing angle to hide the fact that we're using intersecting planes and make the beam look smooth and plausible. The blending should be additive. You should also add some extra effects to the ends of the beam, again to hide the planes.