Advertisement

Using Transparency in DDraw with software

Started by December 14, 2001 08:44 AM
14 comments, last by Askadar 23 years ago
Hi! I''ve been reading about transparency in direct draw and know that I have to implement it in software. I read the articles here, so I basically know how to implement it, but there''s one question that I''ve got: I read that getting pixels from VRAM is really slow, because the video cards are built for blitting, not getting data. So all the tuning in the world won''t help if you''re trying to blit something transparent onto the primary surface, right? Or is this a wrong assumption and it doesn''t matter? In case I''m right, that would mean that one would have to prepare the frame in system memory and one would loose all the advantages of the blitter and surface flipping. Right? Or again wrong? Thanks for you help!
Kill mages first!
Yes reading to/from video memory is very slow.

If you plan to use a lot of alphablending it is best to blit to an offscreen system surface and when you are done blit it to your backbuffer and then flip.
This means that all your surfaces should be kept in system memory even though you don''t plan on using them all for alhablending.

-------------Ban KalvinB !
Advertisement
Isn''t there a way to get around this, or this there no difference (for the framerate, say I lock it to 30 fps anyway) on modern computers whether the frame is created in VRAM or system memory anyway?
Kill mages first!
The VRAM will blt your images much faster than in the system memory, since this is what is VRAM was meant for. Also, copying the memory into the VRAM will be slightly costly.

Though even with that in mind, as mentioned before, it is much quicker than retreiving pixel information from the VRAM.

Gamedev''s AI Auto-Reply bot.
Gamedev's AI Auto-Reply bot.
Now if I prepare the frame in system memory and do a whole lot of alpha blending at 32 bpp, what kind of processor requirements should I expect?

If I have only one 800x600 surface, that I want to fade in and out, will that be doable for old 400Mhz AMDs?
Kill mages first!
nope. unless you use 8bit color with mmx asm, even then you are streching it. your ram is just not fast enough to handle that. if you want to do fullscreen alphablending or a lot of alphablending at high resolution, use d3d or opengl. you still do the game in 2d, but use textured quads instead of sprites. now you get bilinearing zooming, alpha blending, depth buffering, all for virtually no cost (well the video card has limitaions to, but 3d accelerators have much more bandwidth/better designed to handle this stuff). the only true way to know is to actually see for yourself. you may surprise yourself and find the framerate accpetable. but dont expect anything north of 15frames per second (and thats being optimistic).
Advertisement
no, i'm pretty sure you can use transparency in directdraw...
look up "color key" in the docs (or search gamedev.net forums)...
--- krez (krezisback@aol.com)

Edited by - krez on December 14, 2001 7:23:21 PM
--- krez ([email="krez_AT_optonline_DOT_net"]krez_AT_optonline_DOT_net[/email])
I think they are talking about translucency, krez.
Yep, I meant translucency.

So If I just want to fade my background in and out, it might me a better way to just prefade it in Photoshop and load all the frames for a 2 second fade in/fade out. That would of course eat up a whole lot of memory, but at least I would get it to run smoothly.

I''m just learning these things now, so I''m a little bit scared about D3D8, because it looks, well, very complex at least....

Thanks a lot guys for your help!
Kill mages first!
Ups. Just did a little calculation, it would eat a lot more than just a few megs.... Well, maybe I have to look at D3D anyway...
Kill mages first!

This topic is closed to new replies.

Advertisement