How to render an object with texture and transparency

Started by
0 comments, last by Namethatnobodyelsetook 15 years, 5 months ago
How to render an object with texture and transparency? If I render the object(with texture) with the code as below, the object looks like solid without transparency. If I render the object(only with material,without texture) with the code below, the object looks like solid with transparency;

m_pD3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, true);
m_pD3DDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
m_pD3DDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);

SetLight with Alpha channel
SetMaterial with Alpha channel

m_pD3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, false); 

akira32 編程之家 Yahoohttp://tw.myblog.yahoo.com/akira32-akira32
Advertisement
It's up to the alphaop/alphaarg settings you use in your SetTextureStageState calls. You want to modulate texture and diffuse, allowing both the texture opacity and material opacity to work together.

This topic is closed to new replies.

Advertisement