Archived

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

How could i make a transparent poligon?

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

How could i make a transparent poligon? (a miserable triangle), not a textured one, some effect like a glass, maybe i''m grong triying to give this value with the color: #define D3DFVF_VERTICE (D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1) VERTICE g_Vertices[] = { { -1.0f,-1.0f, 0.0f, D3DCOLOR_ARGB(100,0,255,0), 0.0f, 1.0f},.... and doing any draw primitive. All started when i was a little kid... trying to make some smoke effect that vanished while time past (particles) but i couldn''t find the way to make them disapear little by little(alpa?) then i try doing this in a siimple way, and still i can''t please help!!! zorry four the inglish!

Share this post


Link to post
Share on other sites
Make sure these are set

DXDisplay->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );
DXDisplay->SetRenderState( D3DRS_ALPHATESTENABLE, TRUE );

DXDisplay->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_SRCALPHA );
DXDisplay->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA );

Share this post


Link to post
Share on other sites
and don''t forget to get the alpha values from your diffuse color,

ie,

m_d3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_DIFFUSE );
m_d3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);

Share this post


Link to post
Share on other sites
thank''s a lot but i still have one problem... (it''s hard to find when all is written in english... for me) the poligons are only tranparent when i draw them from back to front, if i turn the camera the last one is not transparent (i can''t see the first than now is the last but no least), i''m using:

d3dpp.EnableAutoDepthStencil = TRUE;
d3dpp.AutoDepthStencilFormat = D3DFMT_D16;

(and cleaning the buffer with D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER registers.)

obviusly when i do this, i say that i don''t want to draw my poligons in order, and Dx should order then in the depth buffer (i hope i understood well) but it seems i miss something... or maybe i migth go back to school to learn english. please help... again...!!

Share this post


Link to post
Share on other sites