CG output contains many channels of information in addition to R, G, and B. Two of the most important channels are: [ul]
[li] Alpha: indicates transparency. (1.0 = solid, 0.5 = ghost, 0.0 = invisible.) [*] Depth: indicates the distance of the object from the camera. [/ul]
[/li]What you call “2D” compositing programs, therefore, can do “3D-aware” work because of the presence of these (and other) channels, all of which are normally embedded in a single input file.
Compositors, these days, are almost-universally node based, which means that you can actually construct a sort of “assembly line” by selecting various kinds of filters and plugging them together in different ways. The data “flows” through all of the various “filters and pipes” to finally produce (one or more…) finished outputs.
Incidentally: renderers, textures, materials, and so-on are these days constructed using exactly the same principles.
Naturally, since we’re talking about digital computers, this notion of “merging” can be extrapolated in many different ways. It’s really a matter of using one mathematical function (or output thereof) to somehow influence another, thereby eventually affecting the final-image in some way.
So, you’ve actually got an amazing amount of creative control available to you. This is a very, very, very deep pool. (Ommmm-m-m-m-m… :wise: )
You’ve probably heard that “movies are shot by the director, but they’re made by the editor.” Whether or not you agree with that notion, I think that the same general idea definitely applies to 3D work. The renderer is used to generate components, but “post production” steps are used to fine-tune and assemble them into a completed image. By and large, those steps are working with “bit-mapped images,” accompanied by depth information, assembling layer upon layer of information. But, these processes are quick.