setting render states for transparent objects
ok, in 3DS max, i created a room, and one of the walls are glass, but when i export as a mesh and open it in my c# app, the wall becomes a solid gray rather than a transparent object. im told i have to set the correct render state to allow for transparent objects but i cant seem to figure out how this is done. can anyone explain?
Try the following :
D3DSetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
D3DSetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
D3DSetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
// Set desires texture stage states
D3DSetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE);
D3DSetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
D3DSetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
D3DSetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
D3DSetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
Read the SDK for the correct paramters u need incase this doesn't suit your purpose
D3DSetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
D3DSetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
D3DSetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
// Set desires texture stage states
D3DSetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE);
D3DSetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
D3DSetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
D3DSetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
D3DSetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
Read the SDK for the correct paramters u need incase this doesn't suit your purpose
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement