5

I am trying to implement object independent transparency (OIT) using the following naive technique:

  1. Sort opaque and transparent objects.

  2. Render opaque with depth write on.

  3. Disable depth write, enable alpha blending, and render the transparent objects.

It work ok if I have fully opaque and transparent objects only.But what about the case where some objects have transparent alpha textures (all my meshes are planar) and need Alpha blending on, and other are transparent.What is the routine in this case? Currently, if I render the transparent first with depth write on and alpha blend on too, then rendering the object with alpha channel texture (depth write off, blend on) what happens is that the part of the last rendered plane that intersects into the first plane gets culled. Here is a picture to depict what I am after:

enter image description here

Both planes have some amount of transparency and still maintain depth sort. I know I can use more sophisticated approaches for OIT like this. But is it possible to do it without getting into fragment linked lists etc?

unwind
  • 391,730
  • 64
  • 469
  • 606
Michael IV
  • 11,016
  • 12
  • 92
  • 223

1 Answers1

3

A rasterization-based renderer, by its very nature, cannot handle transparency well. Rasterizers work by rendering an object, then rendering another. It has no idea of what has been rendered before or what will be rendered afterwards. It's job is to take a 3D shape and turn it into a field of colors.

If there was a simple technique for doing order-independent transparency, then you'd have heard about it by now because everyone would be using it. There isn't. Every general OIT technique is complicated and has some performance downsides associated with it.

Is it possible to find a way for the very specific case of two planes intersecting with nothing else on the screen? Yes. Could you generalize that method for arbitrary scenes with arbitrary transparency? No.

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982
  • could you point to the most efficient OIT techniques (in terms of performance)? – Michael IV May 27 '13 at 14:30
  • @MichaelIV: First, that's a completely separate question. Second, it's not really an answerable question; it will depend on your scene complexity and your hardware. – Nicol Bolas May 27 '13 at 15:23