• Advertisement

Archived

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

Using vertex colors and alpha

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

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
Advertisement
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

  • Advertisement