This will be a quick one. Light Path Expressions offer a lot of flexibility over the AOV’s you would like to pass off to Compositing. Most modern path tracing render engines like Arnold, RenderMan, Blender’s Cycles, VRay, etc. have support for it by now. With LPE’s you can split pretty much any light path you desire, which brings me to the solution to this first problem.

Usually when you have a refractive object in your scene everything that is being refracted lands in 1 single AOV (usually called refraction, transmission, or something along those lines).
So if I have a scene like this…




My transmission AOV will usually look like this:



…and my diffuse like this:




As you can imagine tweaking the diffuse in comp will be a bit of a cumbersome task as the color of the teapot for example is in 2 different AOVs. Luckily what you can do is to modify the default LPE’s a bit to include transmissive paths in other AOVs like diffuse, specular, subsurface scattering, etc.

I won’t go into too much details of how it works. If you want a proper overview on LPE’s you can read up on them HERE.
The default diffuse_direct looks like this usually:
Which simply means the lightpath Camera (C) -> Diffuse Reflection event (<RD>) -> Light Source / Emissive Object ([<L.>O])

To make all the light paths include refraction events as well you can tell the light paths to look for zero or more transmissive specular events before evaluating the rest of the light path.
So if you modify the diffuse_direct like this:

… then the diffuse will be a lot more useful for tweaking in Compositing:

Likewise to make sure everything adds back together nicely you can modify the refraction pass to only include pure transmissive events:


As a TL;DR here is the stuff I personally like using:
diffuse_direct: lpe:C<TS>*<RD>[<L.>O]
diffuse_indirect: lpe:C<TS>*<RD>[DS]+[<L.>O]
diffuse_albedo: lpe:C<TS>*<RD>A
specular_direct: lpe:C<TS>*<RS>[<L.>O]
specular_indirect: lpe:C<TS>*<RS>[DS]+[<L.>O]
refraction: lpe:C<TS>+[<L.>O]
sss: lpe:C<TS>*<TD>[DS]*[<L.>O]

If this post has helped you in any way you can express your gratefulness by using the Donate Button below to buy me a coffee! :)