Jump to content
  • Advertisement


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


D3DXMesh and alpha blending

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

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 this post

Link to post
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?


here is some code snippet

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

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!