Jump to content
  • Advertisement
Sign in to follow this  
Icebone1000

wandering about Alpha Blending and Z order(blending on pixel shader)

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

Why is this idea stupid? Im assuming is stupid because I never saw anybody talking about this, so theres probably a huge flaw I cant see, cause Im an idiot.

The pain in the ass about alpha blending is the need to sort your draw calls accordingly with the depth(to me at least) I mean, you will need a scene graph to render semi-transparent objects accordingly with who is closer( if you working with 2d sprites and objects that change "layers"(z), I believe is the worst case)...And theres also the issues with 3d semi-transparent objecs crossed trough others, making ordering irrelevant(it will always have flaws)

But what if you use a depth buffer + a render target as a pixel shader input?

That way you can check at each pixel, who is closer(the old or the new), than compute the blend function with the new pixel plus the one in the render target inputed( if the older is closer, consider it the new)..is it possible?

its late you know, maybe my brain is alredy hibernating e_e

Share this post


Link to post
Share on other sites
Advertisement
What you're describing sounds similar to depth peeling. Most people don't consider it, because it's not cheap (you need N passes for N layers of transparency).

Share this post


Link to post
Share on other sites
I might be misunderstanding your question but I believe you normally handle layering or z buffering well before the shading level. In other words I've always assumed layering to be done in generic render logic prior to sending your vertices to the shaders. In this case you should already know what vertices are where and or in 2D you would already know what pixel's are where in Z Depth.

Share this post


Link to post
Share on other sites
Rings a few bells.
PowerVR seemed to have a polygonal architecture which would somehow sort on a per-fragment basis... even without a Z buffer... with no intervention. Perhaps it's still going around. Don't ask.

When D3D10 was proposed, I think I've read a few documents about multiple z and color buffers. The cost, in terms of memory was scary and they didn't made it to release AFAIK (at least not as API feature)... however it is possible to use shared memory atomics to write sorted fragment lists in a blob of memory, see AMD demo. This is possibly similar to what you'd like to do, it requires some work.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!