#### Archived

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

# D3DXMesh and alpha blending

This topic is 6391 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

what i want to do is load a .x file that contains translucent parts into an D3DXMesh interface, and render it correctly. this doesn''t seem to work, not even with the dx8 samples that display x files. i found out that a D3DXMesh vertexbuffer doesn''t contain color information for the vertices, so i can''t set the alpha value there. but the material that is used to render the translucent parts of the models has a diffuse and ambient alpha value set. but the problem is that d3d doesn''t display that. anyway i couldn''t find out how to get it to work thanks for any suggestions ridcully

##### Share on other sites
i have a quite big problem with alpha blending i think.
i am trying only to render one triangle onto another with alpha blending, but i can't achieve the effect i want to see.

what do i have to do to do alpha blending with d3d8? i currently set the D3DRS_ALPHABLENDENABLE and the D3DRS_DESTBLEND and SRCBLEND, then i set a material with alpha values, but that doesn't work. am i missing something obvious there?

thanks
ridcully

here is some code snippet

	D3DMATERIAL8 mtrl;	ZeroMemory( &mtrl, sizeof(D3DMATERIAL8) );	mtrl.Diffuse.r = mtrl.Ambient.r = 1.0f;	mtrl.Diffuse.g = mtrl.Ambient.g = 1.0f;	mtrl.Diffuse.b = mtrl.Ambient.b = 1.0f;	mtrl.Diffuse.a = mtrl.Ambient.a = 0.5f;	m_pd3dDevice->SetMaterial( &mtrl );	m_pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE ); 	m_pd3dDevice->SetRenderState( D3DRS_SRCBLEND,  D3DBLEND_SRCCOLOR  );  	m_pd3dDevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCCOLOR  );	m_pd3dDevice->SetTexture(0, 0);	m_pd3dDevice->SetStreamSource( 0, m_pVB, sizeof( VERTEX ) );	m_pd3dDevice->SetVertexShader( VERTEXFORMAT );

Edited by - Ridcully on February 19, 2001 10:38:28 AM

1. 1
2. 2
JoeJ
18
3. 3
4. 4
frob
12
5. 5

• 13
• 16
• 13
• 20
• 13
• ### Forum Statistics

• Total Topics
632189
• Total Posts
3004653

×