Archived

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

Texture States for Alpha

This topic is 5873 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, I''ve been playing with MFCTex in DX8 for awhile and have been having trouble to get a regular texture to have alpha of another texture. Here is what I''ve been using: Texture Stages Stage 0 Stage 1 Stage 3 TextureFile env2.bmp spotlite.bmp Color Arg 1 Texture Color Op Select Arg 1 Select Arg 2 Disabled Color Arg 2 Current Alpha Arg 1 Texture Alpha Op Select Arg 2 Select Arg 1 Disabled Alpha Arg 2 Current What am I doing wrong? I''ve been looking on the internet and this seems how others are doing this but it''s not working. Thanks

Share this post


Link to post
Share on other sites
// STAGE 0
SetTexture( stage0, TextureWithRGBColour )

SetTSS( stage0, COLORARG1, TEXTURE )
SetTSS( stage0, COLOROP, SELECTARG1 )
SetTSS( stage0, COLORARG2, DIFFUSE )

SetTSS( stage0, ALPHAARG1, TEXTURE )
SetTSS( stage0, ALPHAOP, SELECTARG2 )
SetTSS( stage0, ALPHAARG2, DIFFUSE )


// STAGE 1
SetTexture( stage1, TextureWithAlphaChannel )

SetTSS( stage1, COLORARG1, TEXTURE )
SetTSS( stage1, COLOROP, SELECTARG2 )
SetTSS( stage1, COLORARG2, CURRENT )

SetTSS( stage1, ALPHAARG1, TEXTURE )
SetTSS( stage1, ALPHAOP, SELECTARG1 )
SetTSS( stage1, ALPHAARG2, CURRENT )


// STAGE 2
SetTSS( stage2, COLOROP, DISABLE )
SetTSS( stage2, ALPHAOP, DISABLE )



1) The texture stage states are a cascade, if you want to do something in stage1 with the alpha channel, then stage0''s alpha channel needs to be enabled. Even if you''re replacing it totally in the next stage!.

2) I notice in your post, mention of stage3 - firstly why no mention of stage2 ? - you should always use stages sequentially. The result of one flows into the next as input. This is physically similar to what''s going on in in hardware.

3) Most cards can only use two simultaneous textures in a single operation. You can''t introduce a third texture. Check the max simultaneous textures in the device caps. Also use ValidateDevice() to ensure that the driver is happy with the operation you''re trying to do (just because the API supports something it doesn''t mean every graphics card ever made can actually do it!)

--
Simon O''''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites