One thing I can tell regarding passes is this:
I won’t go into math unless it will be necessary, but when doing passes for compositing (especially with MB and DOF) is that you can NOT multiply layers on compose. Only thing that you CAN do is add layers. So i.e. with occlusion is you have to render occlusion (or ambient light) with color multiplied with occlusion and then add it to other passes. To give an example of what the passes might be here is a little breakdown of what is usually rendered:
- Texture * Lightpass (blinn, lambert etc)
- Specular
- Reflections
- Texture * Ambient Occlusion
- Texture * Indirect Light
With all the passes above you and simply ADD them in compose to get the final image.
The quick explanation of why you cannot mult passes on compose is that when renderer samples the image it multiplies the resulting color before filtering (gathering weighted samples in stochastic sampling to result final pixel), but if you want to mult on compose you would get artifacts (especially in MB and DOF) because all the weighted sample information is lost, and you cannot multiply the pixels correctly.
At our facility here we had a special software that would output samples and their position instead of pixels to do multiplication in post for some complex scenes, where there would not be enough memmory to compute light, occlusion, gigs of textures and gigs of pointcloud files in a single pass.
Hope that helps