Alpha-Transparency/Alpha-Blending in DirectX && DirectDraw

Started by
27 comments, last by Tony Chamblee 23 years, 12 months ago
I don''t even know if it''s possible. Could someone please get me started on what Alpha-Blending is, and if it''s possible in DirectDraw? If so, what are some basics of accomplishing it? *Tony Chamblee*
Nucleus Software
*Tony Chamblee*
Liquid Flame Software
Advertisement
Okay, well I''ve done quite a bit with alphablending using inline assembly. Yes, it can be done with directdraw by locking the surface

The basic idea is to take a certain percentage of the source color, the opposite percentage which will add to 100% of the destination color, and add them together.

You have to do this for your red, green, AND blue values separately. Otherwise some WEIRD things will happen hehe

If you would like to see my implementation in assembly, it''s available from my website at http://blackhole.thenexus.bc.ca/ under the downloads section as ''vbDABL''. It''s opensource of course

Otherwise, gamedev.net has a couple nice articles about it... I would advise reading those.

David
-- black eyez
dgoodlad@junction.net
Thanks David.

*Tony Chamblee*

Nucleus Software
*Tony Chamblee*
Liquid Flame Software

OK...now I know what Alpha-Blending is...what it''s for.

Now here''s my next puzzle.

I''m still relatively inexperienced to the _standard_ world of game design. I''m used to using the blitter to copy sprites to a backbuffer, then flipping the backbuffer and the primary surface, hence making animation via pageflipping. My question is, where does Alpha-Blending come in this loop? (I obviously have very little understanding of Alpha-Blending.)

*Tony Chamblee*

Nucleus Software
*Tony Chamblee*
Liquid Flame Software
Alpha-blending allows you to blit an image with partial transparency. If you just want a particular color masked out, ddraw can do that for u already. If you want a blending effect (say blue energy from a space ship), you have to blend the two colors. Blending comes when you blit the sprite to the surface. Instead of a usual ddraw blit, you pocy the pixel to the screen one at a time using your blitting routine.
Write more poetry.http://www.Me-Zine.org
Yeah, basically it replaces your normal blit call (though obviously much slower! lol)

David
-- black eyez
dgoodlad@junction.net

Ok, David, which surface do you lock? There are two surfaces, source and destination..

-Tony-

*Tony Chamblee*

Nucleus Software
*Tony Chamblee*
Liquid Flame Software
Both

David
-- black eyez
dgoodlad@junction.net

Alright, so do I have to use two surface descriptions to lock each?

*Tony Chamblee*

Nucleus Software
*Tony Chamblee*
Liquid Flame Software
Okay, well are you using vbdabl or your own alphablending method? (just checking hehe)

Essentially, yes, you should use two separate surfacedesc''s because then you can get the pitch of either one of the surfaces from this.

David
-- black eyez
dgoodlad@junction.net

This topic is closed to new replies.

Advertisement