Skip to main content
GameDev.net gamedev.net
🔒 Locked

Direct3D: Setting the Alpha Source

Started by s9801758 Jun 26, 2000 at 2:08 AM 2 replies 750+ views
Original Post
s9801758
s9801758
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.
____Mmmm, I''ll have to think of one.
WitchLord
WitchLord
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
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - <a href="http://www.angelcode.com/tower" rel
s9801758
s9801758
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.
____Mmmm, I''ll have to think of one.
WitchLord
WitchLord
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
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - <a href="http://www.angelcode.com/tower" rel

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.