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

Started by
2 comments, last by Krohm 12 years, 5 months ago
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
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).
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.

Dan Mayor

Professional Programmer & Hobbyist Game Developer

Seeking team for indie development opportunities, see my classifieds post

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.

Previously "Krohm"

This topic is closed to new replies.

Advertisement