29 Aug 11, 02:55AM
(This post was last modified: 29 Aug 11, 02:56AM by Roflcopter.)
(29 Aug 11, 02:18AM)Lantry Wrote: ...
That wouldn't give the effect it was transparent and will just flicker. However, you could theoretically render two frames, one with and without the object, and accumulate them using OpenGL's glAccum. It's not really practical though since it requires twice the rendering.
One method for rendering transparent objects is to render them last sorting them based on their depth, furthest away first. That involves sorting all transparent objects in a scene by their distance away from the camera. The distance away from the camera is just the vector norm of the object's position and the camera's position and is fast to compute, but sorting a lot of transparent objects takes O(n log n) time naively. But since the order of objects doesn't change much from each frame to the next, using a sorting algorithm particularly effective for partially sorted data could yield an average case O(n) algorithm.