Jump to content
  • Advertisement
Sign in to follow this  
Decrius

Effects

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

I have a 2D tile-based game and would like to include explosions, fire, light beams, fog etc. Explosions and fire I can probably work out, though any link for that is appreciated. Its the beam and fog part of which I have no clue. Do I need to use particles for beams aswell? And how would I make real-time fog? I have really no clue. Does anybody has an example for these effects? Could anyone push me into the right direction? Thanks, Decrius

Share this post


Link to post
Share on other sites
Advertisement
What kind of fog do you have in mind? distance-based fog?
There are many ways to make beams, the simplest is probably just to make one long quad...

Share this post


Link to post
Share on other sites
Fog: no. I have a 2D game so there is no distance. I would like to say: this rect should be filled with fog. Then it would randomly fill it with fog, blending to the borders and it would change every frame too, small wirls etc.

Beams, I basically want that, for instance, you shoot, the path would be lighten up. This path could bow, so a rect for this wouldn't be easy. It should be a sort of neon light in Photoshop :P.

Thanks though.

Share this post


Link to post
Share on other sites
If your game is 2D, then your life is a lot less painful. You won't need the complicated overdraw-heavy techniques like for 3D.

You can do fog as simple as drawing (blending) a quad with some Perlin noise over each affected tile. If you want it to look a bit better, you could create a mask in the stencil buffers on all tiles that should be in shadow, and then draw one full-screen quad with tileable noise (either from a texture, or generated) and stencil testing enabled. That way, the fog will go "smoothly" along, and won't be bound to the tiles in such an artificial manner.
To make it look even better, you could render an alpha mask which has a value of 1.0 for every tile in fog (render to texture). Then run a little blur filter over that mask, this will make the fog fade out on the outer edges (but not between two fogged tiles!). Then draw your fog like above, but blend with the alpha mask.

Fire... likewise. Depending on what level of realism you want, 5-10 photographs of real fire drawn in a semi-random manner may be good enough.

Share this post


Link to post
Share on other sites
Quote:
Original post by Decrius
Fog: no. I have a 2D game so there is no distance.


Oops. I guess I read your post a bit too fast, hehe.

Why don't you just make a basic particle-system for smoke?
If you rotate and change the size for each particle, it'll probably look pretty good.

Quote:
Original post by Decrius
This path could bow, so a rect for this wouldn't be easy.


Well, you could chain multiple rectangles together in a line.

Share this post


Link to post
Share on other sites
I used this link before for a beam type object I needed (it uses HLSL)
http://richard.giliam.net/index.php?title=beam-effects-in-hlsl&more=1&c=1&tb=1&pb=1

So calculate the trajectory and create the triangle strip for it, and use that effect to colour it. If you don't use shaders, the you can just create a gradient image in an image editor to give it a round look and use that as the texture for the triangle strip.

Share this post


Link to post
Share on other sites
Quote:
Original post by davek20
I used this link before for a beam type object I needed (it uses HLSL)
http://richard.giliam.net/index.php?title=beam-effects-in-hlsl&more=1&c=1&tb=1&pb=1

So calculate the trajectory and create the triangle strip for it, and use that effect to colour it. If you don't use shaders, the you can just create a gradient image in an image editor to give it a round look and use that as the texture for the triangle strip.


Bookmarked. Thanks :)

Why HLSL? Is that easier or faster? Yet have to learn that :P.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!