Skip to main content
GameDev.net gamedev.net
🔒 Locked

transparency polygon without sorting

Started by iwaskia Aug 5, 2002 at 5:59 PM 3 replies 800+ views
Original Post
iwaskia
iwaskia
heard that there is a way to render transparency polygon without sorting them, want to learn it
Kippesoep
Kippesoep
There''s several ways:

  • enable alpha-buffering
  • use only additive blending, disable z-write
  • use point-sampled texturing (instead of bilinear filtering, to remove artifacts), with alpha testing enabled and only on/off transparency in your textures
  • make sure there are at most 2 layers drawn on top of one another and use alpha : 1-alpha blending where alpha is always at 50%. disable z-write


I think the first one is the one you''re actually referring to. I don''t think anybody uses it, though. At least, I''ve never seen any code using that.

Kippesoep
Zoot
Zoot
*newbie spam*

Why sorting at all? What is it good for?
GSACP: GameDev Society Against Crap PostingTo join: Put these lines in your signature and don't post crap!
Kippesoep
Kippesoep
quote:
Original post by Zoot
*newbie spam*

Why sorting at all? What is it good for?


If you draw a face with blending enabled over another one with blending enabled, in most cases the output will look different depending on the order you draw them in.

Think about this:
- background is white
- blending is set to src * src_alpha : dst * (1 - src_alpha), which is "normal" blending
- face A has alpha at 25% and is black
- face B has alpha at 75% and is full green

If you draw A, then B the results will be:
white
--> 75% gray
--> 19% gray + 75% green

If you draw B, then A the result will be:
white
--> 25% gray + 75% green
--> 6% gray + 19% green

So, order is important. You achieve the correct results by drawing back to front.

Kippesoep

Topic Locked

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

Sign in to reply to this topic.