Skip to main content
gamedev.net
🔒 Locked

Transparent models

Started by wolfeinstein 1 reply 250+ views
Original Post
wolfeinstein
wolfeinstein
I''m rendering pack of 3d models, using alpha channel of texture for transparency. Take a look a part of code:
g_pD3DDevice->SetRenderState ( D3DRS_ALPHABLENDENABLE,TRUE);
g_pD3DDevice->SetRenderState ( D3DRS_SRCBLEND,D3DBLEND_SRCALPHA);
g_pD3DDevice->SetRenderState ( D3DRS_DESTBLEND,D3DBLEND_INVSRCALPHA);
g_pD3DDevice->SetTextureStageState(0, D3DTSS_ALPHAOP,   D3DTOP_SELECTARG1);
g_pD3DDevice->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);  
 
so transparentcy depends on order of model renders. Take a look at this pics. The big one model located near EYE and drawn first in render chain. - I can''t see model located far from view. Other one - Big nodel drawn after far models and all fine. Is it possible to render models without calculating order of rendering to make visible other one, even near model renders first? P.S. Really i got a wing with one transparent line in the middle (not all like on pics) and it slowly graduate to notransparent
Game programmer.DirectX9, OpenGL.
ProtoPornoPants
ProtoPornoPants
If you want alpha polys to render correctly then you will need to render them from back to front. If you think about it, the depth buffer only has 1 piece of depth information per pixel. So if you render a big alpha poly at the front of the screen, then as far as the depth buffer is concerned that poly could be opaque and nothing behind it will pass the depth test.

Rory.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.