To handle the problems of transparency many different algorithms have been suggested, here comes a short summery of some of them:

**Painters Algorithm
**The idea is to work like a painter by adding the background first, and then add the next layer, maybe some distance houses and work through all the layers till you are at the front figures. In 3D rendering this would be to sort all the objects on the distance to the camera. This algorithm has many problems as can be seen in the image below, which colored rectangle is furthest away from the camera?

**Depth Peeling
**Renders the transparent objects

*n*times, where

*n*is the number of transparent layers in the scene. It uses the depth buffer to find the first layer, rendering it and then “peeling” it by increasing the depth, so the next rendering pass will ignore any pixels rendered in a previous pass.

*Depth Peeling*renders the image correctly but needs to render the scene many times.

**Stochastic Algorithms**

To speed up the algorithm and use a fixed amount of memory, it’s possible to use sample the transparency using a random sampling pattern. The idea is to take *n* samples for each pixel to be rendered and try to make the number of samples for each transparent layer proportional to how much they contribute to the final color e.g. if we have 3 layers, front (a) 75% transparent, middle (b) 25% transparent and background (c) 0% transparent. We use 16 samples (4×4 pixels) and then render order is (b) -> (c) -> (a). (b) is rendered, filling 75% of the samples and also keeping track of the depth. (c) is rendered, since it’s depth is lower and covers 100%, it fills all the samples not filled by (b). Finally (a) is rendered, with the lowest depth, it writes on top of all the other samples, filling 25% of the samples.

When all the samples are gathered the average of these 16 samples is used as the color for the pixel.

**Commutative Function
**The rendering function for transparency is not commutative, that means that it’s not possible to switch places of the terms in the function (in the rendering this means that the layers must be rendered back to front). If it would be possible to find a function that has the same result as the transparency function but where the terms could commutative would make it possible to render the layers in any order. There are some attempts to find a function with these properties but all of them only give an approximation of the of the correct result. The equation below is the transparency equation and it’s repeated iteratively, back to front.

**Per Pixel Linked List
**To get an exact result all the layers must be saved and drawn in the correct order. To accomplish this on a graphics card a method where each transparent layer’s pixels are stored in linked lists can be used and then finally sort the lists and render it. This uses both lots of memory, GPU time and require some kind of synchronization for the lists. Approximations exist where only the

*n*top most layers are saved to reduce the GPU usage.

**Weighted Order Independent Transparency
**An

*Commutative Function*using the depth buffer to improve the closest layer. This algorithm creates one correct layer while the other are approximated.

**Adaptive Transparency
**Uses a combination of

*Per Pixel Linked List*with storing the top layers and then making an approximation of the background layers using a

*Commutative Function.*