Jump to content
  • Advertisement

Archived

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

The Frugal Gourmet

Alpha Blending -- Z-order independent...

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

I thought I was being clever by sorting all my billboards (sprites) by their associated textures, so as to avoid as many SetTextures() and other state changes as possible. Unfortunately, I quickly realized that alpha blending doesn''t work this way. It blends based on what has already been drawn first. So, if I want alpha-blending to work, I can only my render my billboards from back to front. Is this correct? Just making sure...

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
that''s right, render alpha stuff last and render it from back to front if you want to blend it, you might could use additive blending if your situation permits then you dont have to sort from back to front, for most particle system type things an additive blend works fine

Share this post


Link to post
Share on other sites
quote:
Original post by The Frugal Gourmet
I thought I was being clever by sorting all my billboards (sprites) by their associated textures, so as to avoid as many SetTextures() and other state changes as possible.

Unfortunately, I quickly realized that alpha blending doesn''t work this way. It blends based on what has already been drawn first. So, if I want alpha-blending to work, I can only my render my billboards from back to front.

Is this correct? Just making sure...

- Usually, people render all non-translucent objects first, then do a rough back-to-front sort on translucent objects and render them last.

- There''s a paper on nVidia called something like "order independent transparency" or similar, that doesn''t require what you describe. It might be a little complex though, plus it only works on nVidia hardware (If I recall correctly)



Muhammad Haggag

Share this post


Link to post
Share on other sites
Aw.... oh well. I don't want to implement something that's hardware specific or very time-consuming..

It just kind of disappointed me that my rendering pipeline could automatically arrange and show objects in the correct z-order (regardless of the order in which they are drawn), but it couldn't automatically alpha blend objects using that same z-order...



[edited by - The Frugal Gourmet on February 27, 2004 1:42:58 PM]

Share this post


Link to post
Share on other sites
a technique similar to depth peeling is what you are looking for. see nvidia website for more. it''s a multipass technique based on pixel shaders. That''s also the technique used for "order independent transparency" already mentioned earlier...

Share this post


Link to post
Share on other sites
IIRC, D3DXSprite in DX9 Summer Update will do the sorting for you. It''d likely be faster for you to do it yourself (save yourself sorting each frame), but it''d be quick to get up and running and quite possibly have good enough performance.


Stay Casual,

Ken
Drunken Hyena

Share this post


Link to post
Share on other sites
quote:
Original post by DrunkenHyena
IIRC, D3DXSprite in DX9 Summer Update will do the sorting for you. It''d likely be faster for you to do it yourself (save yourself sorting each frame), but it''d be quick to get up and running and quite possibly have good enough performance.



Yeah, I actually tried that first because it seemed easiest, and I''m all about the easiest implementation.

But, I seem to remember there was some aspect of my textured quad class that it didn''t support. Perhaps it was screen depth (z pos)? My engine is actually a mix of 3D and 2D, and I like to be able to set whether things are in front of or behind my 3D objects.

In any case, I think I''m all right sorting by z-order now instead of by Texture. I was worried that too many SetTextures() would incur a noticeable speed difference, but it really hasn''t affected any of my test systems...

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!