Jump to content
  • Advertisement
Sign in to follow this  
tokaplan

Beam weapon!

This topic is 4764 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

My goal is to draw a beam (remember beam weapons in Star Wars?) - the shiny dashed line produced by a weapon. But still I can't decide which approach to choose. My first thought was to use a particle system, which gives very nice effect, but I'm afraid it would be too slow. Now I think of using sprites but, again, not sure it's gonna work. Any suggestions or references? Thank you

Share this post


Link to post
Share on other sites
Advertisement
Hi Tokaplan,
Have you looked in to using volume textures?
I havn't used them myself so I can't give you much info, but from a quick look at the SDK docs, they maybe useful for what you need.

From SDK Help file:
Quote:

"You can use volume textures for special effects such as patchy fog, explosions, and so on."


Search on "Volume Texture Resources" in the SDK help file.

HTH,
Cambo_frog

[Edited by - Cambo_frog on July 31, 2005 9:02:34 AM]

Share this post


Link to post
Share on other sites
What you need is a textured polygon from point A (source) to point B (destination), orientated towards the camera at all times. Then you can texture it with a semi-transparent image. To make nicer effects you can reblend several copies at slightly different positions to give a "shimmery" effect, and use more polygons to give neater start and end segments.

Here's one I made earlier ;)

Image hosted by Photobucket.com

That the kind of effect you're looking for?

Share this post


Link to post
Share on other sites
Yeah, this is exactly what I need! It looks great! Only I'm gonna make it dashed, but I think that would be very much the same. Tank you so much!

Share this post


Link to post
Share on other sites
Yep - much the same, except on thing you will have to take into account is that the beam segment will be stretched depending on the beam length.

If your beam texture is dashed then if you simply mapped it straight onto the segment, the dashes will be stretched with long beams, and bunched up for short beams.

To correct this you'll need to change the mapping coordinates, dividing by the beam length.

One thing I didn't mention is at the start and end you'll also want to blend some nice billboards, textured with flares or somesuch so that the beam is seamless and doesn't end in nasty-looking blunt ends. Which would be bad :)

Share this post


Link to post
Share on other sites
I just knocked it up in Photoshop. Its only a line which is almost white in the centre and fades to the beam colour. The alpha channel is solid in the centre, and fades to transparent - except at the end which is a "bulb" shape. The engine takes the top half and puts it at each end of the beam, and copies the bottom part onto the beam length.

The real trick is to make sure you use additive blending so that it appears brighter and lights the landscape more effectively.

Then I just plonk two billboarded lens-flare-like particles at the ends, add some sparks and smoke and bingo you have some beam effects which will hold up even relatively close to the camera - though I created them for an RTS.

Share this post


Link to post
Share on other sites
What happens if the beam is pointed straight at the camera? It would show as a very thin line if you just use a quad, no?

I think maybe using a capsule or a cylinder might be a bit better, and it shouldn't make it that much more complicated...

Share this post


Link to post
Share on other sites
Well, this will only really be a problem if the beam intersects the centre of the camera incredibly closely. This is very difficult to do in practice so usually doesn't become a problem.

You could add cases where a billboard is placed at the intersection of the viewing plane to represent the "thickness" of the beam, though most of the time it isn't really neccasary. Good point though :)

[edit] if you use more complex geometry you are a) adding huge slow-downs to a system which is really wanted for speed, b) introducing much more complicated texture mapping problems - mapping a quad gives you far more control than a cylinder or box. Lastly most laser beams only appear for a couple of frames, so probably isn't really neccasary to do anything about it. [/edit]

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!