Original Post
🔒 Locked
Alpha blending
Advertisement
G''day!
SetTextureStageState = SetTSS
SetTSS(0,D3DTSS_ALPHAOP,D3DTOP_MODULATE)
SetTSS(0,D3DTSS_ALPHAARG1,D3DTA_TFACTOR)
SetTSS(0,D3DTSS_ALPHAARG2,D3DTA_TEXTURE)
Use SetRenderState to set the TEXTUREFACTOR to have an alpha component equal to what you want (0x7F in this case) and you''re set.
Alternately, you can use D3DTA_DIFFUSE (instead of TFACTOR) and change the alpha in your vertices.
Usng DIFFUSE can be a pain since if the value changes a lot, you have to lock the vertex buffer each time. On the other hand, older cards have poor support for TFACTOR.
Other options:
-Materials can store alpha info (only works if you''re using lighting)
-VertexShader. You can pass the blend amount in as a shader constant. (I keep meaning to try this)
Stay Casual,
Ken
Drunken Hyena
SetTextureStageState = SetTSS
SetTSS(0,D3DTSS_ALPHAOP,D3DTOP_MODULATE)
SetTSS(0,D3DTSS_ALPHAARG1,D3DTA_TFACTOR)
SetTSS(0,D3DTSS_ALPHAARG2,D3DTA_TEXTURE)
Use SetRenderState to set the TEXTUREFACTOR to have an alpha component equal to what you want (0x7F in this case) and you''re set.
Alternately, you can use D3DTA_DIFFUSE (instead of TFACTOR) and change the alpha in your vertices.
Usng DIFFUSE can be a pain since if the value changes a lot, you have to lock the vertex buffer each time. On the other hand, older cards have poor support for TFACTOR.
Other options:
-Materials can store alpha info (only works if you''re using lighting)
-VertexShader. You can pass the blend amount in as a shader constant. (I keep meaning to try this)
Stay Casual,
Ken
Drunken Hyena
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement