Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Special effects?

This topic is 5371 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''m making a 2d game with directx and right now I''m working on the special effects. Most of the ideas I had involve playing around with images on the pixel level, but as far as I can tell, direct3d isn''t made for that. I know you can lock the back buffer and play with the pixels that way, but that would slow down my performance quite a bit and is not recomended by anything I''ve read. I was wondering if it''s reasonable to lock a texture, play around with the pixels and then unlock and render it every frame? Would this cause too much of a hit in performance? Is there some way around this? For example, I want to make a little circle where the color of each pixel is the opposite color of the pixel under it... any ideas on how to go about that with reasonable speed in direct3d? I can''t think of any way besides locking the back buffer every frame and I really don''t want it to come to that.

Share this post

Link to post
Share on other sites
Your best option is to pre-process your effects bitmaps.

Im not sure but i think you can apply some effects filters to them quite quickly, doing stuff like fades, etc....

Imagine having a certain amount of bitmaps flying arround the screen, diferent sizes, diferent textures, diferent effects, etc....

Thats how the majority of effects are made. Don''t even try to manipulate things at pixel level, unless you''re using pixel shaders or something, it will kill whatever performance you had...

Salsa cooked it, your eyes eat it!
[Hugo Ferreira][Positronic Dreams][Colibri 3D Engine][Entropy HL2 MOD][My DevDiary]
[Yann L.][Enginuity] [Penny Arcade] [MSDN][VS RoadMap][Humus][BSPs][UGP][NeHe]
                          Prozak - The GameDever formally known as pentium3id

Share this post

Link to post
Share on other sites
I realize most game effects are done using particle systems or layers of textures... I was just wondering if there was any way to do things that seem like they can only be done by pixel manipulation, like the example of using the opposite pixel color in an area.

Does anyone know if pixel shaders would work for something like that or if it would be overkill?

[edited by - Subconscious on March 27, 2004 1:33:37 PM]

Share this post

Link to post
Share on other sites
You can do dynamic texture effects, but you generally have to limit yourself to small textures or the performance hit is too much. Create a DYNAMIC texture (or Managed if DYNAMIC isn''t supported), lock it, update, and unlock.

For your inverse colour circle effect, this might work (though I haven''t tested it). Create a texture that is transparent except for a circle. Set ALPHATEST so the transparent pixels are skipped. Then set you render states:

I don''t know how well that is supported so you''d have to check your CAPS as well.

Stay Casual,

Drunken Hyena

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!