Archived

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

transparency - optimizations

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

Hi programmers, I normally use the following procedure to have total transparency, but my fps decreases a bit: g_pD3DDevice->SetRenderState(D3DRS_SRCBLEND,D3DBLEND_SRCALPHA); g_pD3DDevice->SetRenderState(D3DRS_DESTBLEND,D3DBLEND_INVSRCALPHA); ... g_pD3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE); Please, would you have some hints about avoiding a big performance loss (when I use transparency)? Thanks.

Share this post


Link to post
Share on other sites
quote:
Original post by adriano_usp
Hi programmers,

I normally use the following procedure to have total transparency, but my fps decreases a bit:

g_pD3DDevice->SetRenderState(D3DRS_SRCBLEND,D3DBLEND_SRCALPHA);
g_pD3DDevice->SetRenderState(D3DRS_DESTBLEND,D3DBLEND_INVSRCALPHA);
...
g_pD3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);

Please, would you have some hints about avoiding a big performance loss (when I use transparency)?

Thanks.



Try this :

- First, in your data pool, try to separate plain objects from transparents object - ( or plain primitives from transparent ones ). So when you''ll display your scene, you will be able to set those flags only for transparents objects. I think that that''s the major optimization you can do, for it would also reduce your sort time ( plain objects don''t need to be sort... )

- Use alpha test for objects that only have an "all-or-nothing" transparent value ( it means objects with maps where alpha value is either 0 or 255 ) like fences, ....

Sorry for my poor english, but I think you''ve understand !

Share this post


Link to post
Share on other sites