3
\$\begingroup\$

I am creating this little 3d space shooter and am somewhat unsure on how to implement the laser beams.

I'm thinking about something along Star Wars and the like where mostly you shoot rather short laser beams but very many of those.

Should I create a "tube" for each of the beams, render them via instancing and give them a better look just with the shader?

How would you go on about this? I was rather perplexed that there was no good tutorial on this matter out there.

\$\endgroup\$
3

2 Answers 2

3
\$\begingroup\$

You can also assume that "laser beam" is cylinder, and create a billboard for that:

http://www.opengl-tutorial.org/intermediate-tutorials/billboards-particles/billboards/

\$\endgroup\$
1
  • \$\begingroup\$ This is the superior answer IMO! \$\endgroup\$
    – Alan Wolfe
    Commented May 21, 2015 at 0:55
5
\$\begingroup\$

I would do this by rendering textured quads. A single laser beam would be two rectangles intersecting each other at the center by a perpendicular angle, each sharing the same texture of the laser beam.

enter image description here

Not very much to it, you can use instancing for them, with a very simple pixel shader which just samples the texture, oh and additive blending.

\$\endgroup\$

You must log in to answer this question.

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