Archived

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

xropi

ALPHATESTENABLE

Recommended Posts

I read the following sentence: ''It''s usually a good idea to Turn the Alpha Testing off when it''s not needed'' in the article : ''Transparency in D3D Immediate Mode'' ( http://www.gamedev.net/reference/articles/article787.asp ) WHY? If the test fails, access to the source colour is not required to render the pixel. This is speed-up, isn''t it? Ropi

Share this post


Link to post
Share on other sites
When alpha testing is enabled (and regardless of whether it fails or not) a per-pixel testing operation is performed. If you know that the alpha test is not needed, you can avoid this unnecessary operation by turning alpha testing off.


[edited by - spock on August 15, 2002 7:06:49 PM]

Share this post


Link to post
Share on other sites
Ok, it has extra cost to check weather or not to perform the blending, but:

cost of test : x extra cycle (I suppose x = 1)
cost of blend op : > x cycle (reading memory for dest pixel, make the linear combination of src and dest colours, write back pixel)

If it''s well implemented in hardware, alpha test should be very fast.

Why alpha blend operations so slow? Because of the memory reads while calculating the output colour. This needs huge memory transfer rate and this is the reason of the slowdown.

I still can''t imagine how can be an internal cmp op. so bad!

Share this post


Link to post
Share on other sites
If you know that the alpha test will ALWAYS pass/fail, there''s no reason for the test. For example, if you are always blending with 50% transparency, there''s no reason to test.

But you''re right, it''s very fast in any case.

Share this post


Link to post
Share on other sites