Archived

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

Lazy303

Using vertex colors and alpha

Recommended Posts

Lazy303    122
Hi! I want to color my polygons with the diffuse vertex color and use diffuse color alpha. struct CUSTOMVERTEX { D3DXVECTOR3 position; // The position D3DCOLOR color; // The color FLOAT tu, tv; // The texture coordinates }; I''m not sure what texture stages to use, these are not right... SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE ); SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE ); SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE ); SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE ); SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE ); SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_?????);

Share this post


Link to post
Share on other sites
Darrell L    122
This is what I use at initialization:

SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, true);
SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_SRCALPHA);
SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_INVSRCALPHA);
SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE);

Then I use SetMaterial during rendering as needed to set the appropriate ambient, diffuse, ... values.

Share this post


Link to post
Share on other sites