Talk:GLSL Programming/Blender/Transparency

"(Obviously, if you blend an (almost) opaque green over an (almost) opaque red, the result will be different from blending an (almost) opaque red over an (almost) opaque green.)"
 * => I don't understand, it's not obvious enough for me :)


 * I was thinking in terms of the examples given in the second paragraph of the page: "transparent glass, plastic, fabrics, etc.". If you look through an almost opaque red glass at an almost opaque green glass, you will "obviously"(?) see a different color than by looking through an almost opaque green glass at an almost opaque red glass. In the first case you will mostly see red, in the second case mostly green. --Martin Kraus (discuss • contribs) 11:56, 21 May 2012 (UTC)


 * AdditiveColor.svg
 * When I read about lights and colors, I think about the picture to the right. So my first intuition is to think that theoretically the order of the red and green glasses doesn't matter.
 * Now that you wrote down the expect result of each glass combination, it's starting to make more sense to me :) Beuc (discuss • contribs) 20:34, 25 May 2012 (UTC)

I believe one of the main issue is defining "blending" - until a few minutes ago I thought it was only about transparency. Apparently it's not. Even looking at the additive samples (the double-exposure camera pictures) looked like transparency to me, until I realized transparency was averaging rather than additive.


 * In my understanding, "transparency" in computer graphics is a feature of colors (or materials). For usual alpha-blending, transparency is one minus the alpha channel. However, if you use other blending equations, you might have to change the definition of what transparency is. I don't think of transparency as an equation. Therefore, I wouldn't say that "transparency was averaging rather than additive"; these are features of blending equations, not of transparency, which is just a value. I'm not sure what you refer to when you say "transparency", maybe the thing I would call "alpha-blending"? --Martin Kraus (discuss • contribs) 11:56, 21 May 2012 (UTC)


 * Yes, what I called "transparency", or "see-through effect", is what you're calling "alpha-blending". I wasn't sure of what you meant by "alpha-blending" myself and avoided using that term.
 * Still not sure how to call the set of "see-through effects" that includes alpha-blending.
 * Also, in section title "Order-Independent Transparency", do you mean Transparency == Blending, or Transparency == kinds of "see-through" effects? Beuc (discuss • contribs) 20:34, 25 May 2012 (UTC)

Possibly, one way to clarify would be a list of various alpha/blending types, including order-dependant and order-independant types.

For each type, I would suggest adding an example than can only be done with that type (e.g. in the order-independant page, there's the example of grey filters, but can't it be done with a semi-transparent black transparency as well?


 * I'm not sure what you refer to when you say "transparency". If you refer to alpha-blending, then, yes, grey filters can be achieved with alpha-blending using semi-transparent black. The problem with your suggestion is that there are 10*10=100 different possibilities for the blend equation in Blender (10 possibilities for the source factor and 10 for the destination factor). Porter and Duff discuss a subset in their classic paper (Porter, Thomas; Tom Duff (1984). "Compositing Digital Images". Computer Graphics 18 (3): 253–259) and try to give some of those blend equations names (e.g. "over", "under" etc.) but there are too many possibilities to discuss them all (even for Porter and Duff) and most of them are useless. Therefore, I decided to discuss only about a handful of the most common ones (in my subjective experience). Feel free to add more. --Martin Kraus (discuss • contribs) 11:56, 21 May 2012 (UTC)


 * I didn't know there were this many blending equations (I thought most didn't make sense).
 * So what I suggest is to explain:
 * - there are multiple blending effects,
 * - one of them (one-minus-alpha) is the one we're familiar with (OpenGL, image manipulating programs...); it's formally called "XXX" ("alpha-blending?")
 * -- alpha-blending is not the only way to implement a "see-through" effect, cf. "Order-Independent Transparency" (?)
 * -- another one is additive blending; double exposure is a good example; particle system is another good example, but the examples are in 2 different sections; Can it be used instead of one-minus-alpha in OpenGL apps?
 * -- another one is multiplicative blending; grey filter is a less interesting example because it can be done with one-minus-alpha
 * - another blending effect (but not a transparency effect) is YYY
 * So as I currently see the overlapping concepts: blending includes "see-through effects", which in turn includes alpha-blending and order-independent blending. Beuc (discuss • contribs) 21:37, 25 May 2012 (UTC)

Similarly, the double-exposure in the example pictures feels like a good-enough transparency effect approximation, rather than an effect in its own right. To put it another way: what kind of additive/multiplicative/etc. effect can the reader add in a video game that he doesn't already have with transparency?).

Beuc (discuss • contribs) 21:56, 20 May 2012 (UTC)


 * If you refer to "transparency" as alpha-blending, the typical application of additive/multiplicative blending (i.e. order-independent transparency) would be to avoid to have to sort semitransparent objects. Alpha-blending requires to sort triangles in visibility order, which can be expensive (both with respect to implementation and with respect to rendering) and there are cases where visibility ordering is impossible without breaking triangles or rasterizing them multiple times (you can arrange three triangles A, B, C in a visibility cycle: A occludes parts of B, B occludes parts of C, and C occludes parts of A; in which order do you rasterize the three triangles to get correct alpha-blending? Answer: there is none.) By using order-independent blending, you don't need to care about ordering your objects/triangles. As mentioned in the text, particle systems are a good example, because they consist of lots of particles and you often don't want to sort them in visibility order for each frame.


 * I missed the mention of particule systems.
 * The "Blending equations" section sounded like a section about a low-level implementation details, so I must have skept in partially, while I now see it explains concepts as well.
 * Since that section is a single chunk of text with no clear paragraphs, mainly due to the mix of explanations and code one-liners, I think it loses clarity. It might make sense to write a section with the recap I added just above, and then another one with the matching blending equations. Beuc (discuss • contribs) 21:37, 25 May 2012 (UTC)


 * Also, I should mention that I don't know what Blender's "Z transparency" in version 2.63 does. When I checked this example, it appeared that it sorts triangles correctly. But when I looked at the other example with the textured sphere, it didn't sort triangles correctly. Thus, I'm not sure what "Z transparency" does and there are probably some bugs in Blender currently. (Also, I have no idea what the different blending modes in the Blender menu are good for.)


 * I agree that in this page I focused much more on the technical possibilities than on the practical applications in computer graphics. And maybe this approach is out-of-place. However, there is a good reason for this: blending is part of the fixed-function pipeline, it is not "programmable" (i.e. you cannot write a blending program). Thus, it is quite important to know what is possible and what is not possible since you cannot assume that everything is possible (i.e. programmable). --Martin Kraus (discuss • contribs) 11:56, 21 May 2012 (UTC)


 * I like the theoretical approach. I just had troubles to relate the new concepts you explained to what I was already familiar with.


 * I updated the page based on your suggestions. Could you have a look and comment on it? --Martin Kraus (discuss • contribs) 08:52, 26 May 2012 (UTC)


 * The new ordering looks clearer.
 * I like removing the link between "back-faces" and "order-independent transparency", this had me confused.
 * You could add a note in the section about additive blending like: "Note that the alpha component is NOT used in this equation - it is not alpha-blending, but it still relates to transparency."
 * Thanks! Beuc (discuss • contribs) 21:07, 28 May 2012 (UTC)


 * OK, I added the note. Thanks! --Martin Kraus (discuss • contribs) 16:04, 29 May 2012 (UTC)