Jump to content
  • Advertisement
Sign in to follow this  
serratemplar

OpenGL lasers, lightsabers, lightning, magic lights, and anything else pretty?

This topic is 4079 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

What is a good way all-around (for looks and speed) to render a laser. (My API of choice is OpenGL, if that matters.) Currently what I'm doing is using the accumulation buffer and making several rendering passes: one for the lasers, one again with slightly bigger, 50% or more alpha'd lasers that I blur with the first lasers, then one for the scene...mash 'em all together and, well, this does look pretty good. But it's 1. kind of slow, I can't get it over 30 fps, and 2. recently people have explained to me that the accumulation buffer isn't supported on hardware universally, so some systems will end up running my algorithm with software. >_< I believe my next step is to dive into shaders? But I'm not certain they will accomplish what I need, and - like anything new in programming - I'm not sure where to start looking or reading. =) Or perhaps there is some other, more common technique with which I am not familiar? Thank you in advance.

Share this post


Link to post
Share on other sites
Advertisement
You could pull of a fairly convincing light-sabre with an additively-blended texture. Create a 'soft beam' texture with colours running from black on the edges, through the hue of your choice, to white in the centre. Set the blend-mode to 'add' and draw it.

Better yet, you could take advantage of some post-processing techniques to produce that overexposed halo effect. A heavy bloom pass would do the trick. This isn't incompatible with the previous method - in fact, I think they'd complement each other nicely. Considering that you haven't played with any shaders yet, this is a little more ambitious, but it's entirely achievable if you put the effort in.

The other effects you list use the same essential technique.

Admiral

Share this post


Link to post
Share on other sites
have a glow buffer
its similar to a bloom that ppl use but it only blooms stuff that u want eg lazers + not ppls faces etc

Share this post


Link to post
Share on other sites
You dont need glow or bloom for this :)
Nvidia has a demo in its SDK called "Cg Volume Lines" and an according whitepaper: http://download.developer.nvidia.com/developer/SDK/Individual_Samples/DEMOS/OpenGL/src/cg_VolumeLine/docs/VolumeLine.pdf

The technique is very easy to implement, very fast and gives great results =) Using it myself for laser swords and usual lasers =)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!