Jump to content
  • Advertisement

Archived

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

s9801758

Direct3D: Setting the Alpha Source

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

Hello people, I''m experimenting with translucency a little bit and now I''m wondering how I can set the source alpha. I have a polygon with only one texture on it in the first texture stage. This polygon contains an alpha channel. My vertex colors also contain alpha values. Now here comes: how can I set the source alpha to come from the interpolated vertex colors? how can I set the source alpha to come from the alpha in each texel? Are these two setting mutual exclusive? If not, how to they work together??? Thanks for any info, I checked the D3D docs by the way but couldn''t find an answer on this one. Jaap Suter ____________________________ Mmmm, I''ll have to think of one.

Share this post


Link to post
Share on other sites
Advertisement
You''ll want to use:

SetTextureStageState(0, D3DTSS_ALPHAOP, ?);
SetTextureStageState(0, D3DTSS_ALPHAARG1, ?);
SetTextureStageState(0, D3DTSS_ALPHAARG2, ?);

I''m sorry but I don''t have the docs right now so I can''t give any more precise info. Read about those commands in the docs and you should be able to figure it out.

- WitchLord

Share this post


Link to post
Share on other sites
I understand that. Thanks for the reply.

They can be used to control the alpha source from the texture. Set it to ONE to disable alpha source from texture and set it to ALPHA to enable alpha blending on each texel.

But what about the interpolated alpha value that comes from my vertices. How can I disable that? So even if my vertices contain a less then 255 alpha value I want full opacity.


Jaap Suter

____________________________
Mmmm, I''ll have to think of one.

Share this post


Link to post
Share on other sites
I don''t think you do understand, there is no such thing as setting it to ONE or ALPHA.

You can set D3DTSS_ALPHAOP to the following values: Texture Operations, and the arguments can have the following values: Texture argument flags.

If you want to disable alpha from the texture stage completely you can set ALPHAOP to D3DTOP_DISABLE. If you want to get alpha from the texture you seet ALPHAOP to D3DTOP_SELECTARG1 and ARG1 to D3DTA_TEXTURE. To get the iterated alpha you set ARG1 to D3DTA_DIFFUSE instead.

From the above links I think you can figure out how to combine diffuse alpha with texture alpha.

- WitchLord

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!