Order independent transparency: Difference between revisions
No edit summary |
|||
| (2 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
Transparent objects need to be rendered from back to front. This is simple to do each frame on CPU when you have a limited number of convex meshes which are small relative to their distance to each other. | |||
However, when parts of a mesh overlap each other, you have large meshes which overlap each other, or you have a huge number of transparent objects, it may be necessary to switch to an order-independent transparency. | |||
The main idea of order-independent transparency is to either: | |||
# Approximate transparency using a commutative operation, i.e. addition. | |||
# Render fragments (per-pixel colors) from back to front. | |||
==Additive Transparency== | ==Additive Transparency== | ||
| Line 26: | Line 32: | ||
==Per-Pixel Linked Lists== | ==Per-Pixel Linked Lists== | ||
This method requires an atomic counter or storage buffers with atomic operations, available in OpenGL 4.2+, Vulkan, and WebGPU. It also requires a small amount of overdraw since sorting needs to happen per pixel. | |||
The idea is to have each pixel build a linked list of each fragment being drawn. Then the linked list will be sorted and rendered back to front. | |||