Why is alphablending so confusing?

Started by
3 comments, last by d000hg 21 years, 8 months ago
Setting the D3DRS_ALPHABLENDENABLE I can deal with, also the texture state stuff for selecting to get alpha from the diffuse colours. But what''s the deal with DESTBLEND and SRCBLEND - I don''t get why we have two, what exactly they''re for and what all the different options do! How do you know what DESTBLEND to use for a given SRCBLEND? I have something working, it''s just what is the point. I''m using this to render 3 textures, I want them to be blended rather than drawn transparently on top of each other, if you get the distinction. Incidentally, why have I never seen ARG0 mentioned as a texture stage argument, and why is it hidden at the bottom of the list of things in the SDK docs, not with ARG1 & ARG2? With a 3 ARG OP such as LERP, which ARGS would become #1,#2 & #3? Read about my game, project #1 John 3:16
Advertisement
you got src and dest blend to tell d3d how you want the destination and source pixels to look like when you draw them, so you can use all kinds of stuff.

the default is src 1 and dest 0 and this means i don´t want to see the destination color at all (the "old" color) and i want to see the srouce color amazingly.

so if you look on the basic alpha blending thing with srcalpha nad invsrcalpha you tell d3d that the source color will have the source alpha and the destination color will be ugly, i.e. 1 - src alpha and then if you draw someting at 70% you will see 70% of it and 30% of the old color.

so you got all kinds of stuff there and you can experiment and dance to the great sounds of the.. err.. dunno.

May The Gzoo Be With You!
~Lord Gzoo
--Amir
SRCBLEND: Original color
DESTBLEND: Color to be blended into original color.

Think of it like two tubes of paint. What happens when you mix 100% (1.0) of the first color (SRCBLEND) and 30% (0.3) of the second color (DESTBLEND)?
Still makes no sense. Thought the point of alpha was you drew a poly, the alpha says how much of what''s underneath gets drawn. Having to set individually all the bits of what''s going on just seems pointless, obviously I''m missing something here


Read about my game, project #1


John 3:16
G''day!

There are 2 different parts to this: Renderstates & Texture Stage States. They are really 2 completely different things that work together.

Your TSS (ALPHAOP etc) specify how(and if) an alpha component is generated. The alpha component itself does nothing, and may be used for effects other than standard alpha blending.

The renderstates (ALPHABLENDENABLE, SRCBLEND, DESTBLEND) do alpha blending and they state how. Often they specify that the alpha component is used (SRCALPHA, INVSRCALPHA) for blending, but it''s not required. For example, setting SRC & DEST to ONE gets you additive blending which requires no alpha component.

ARG0 is "hidden" at the bottom because they chose to list the enumerations in order of their value. ARG0 is only used for triadic ops, and they''re new so they had to assign a higher number to it.

Since Arg1 & Arg2 are already defined, I would assume that Arg0 is the "third" argument. It is non-intuitive though. I''ve logged a doc bug on it, hopefully they''ll clean up the docs a bit for the DX9 release.

Stay Casual,

Ken
Drunken Hyena
Stay Casual,KenDrunken Hyena

This topic is closed to new replies.

Advertisement