Hi,

TL;DR: source gray is essentially exposure compensation (applied on input), target gray is essentially a simple tone curve to control the overall brightness. source gray affects how the tone mapping from scene linear to log is performed (and what gets clipped), whereas target gray affects how the remapping from log to display linear (i.e. in [0,1]) is performed.

A somewhat more detailed answer:

source gray lets you specify what in your input image (i.e. in your â€śsceneâ€ť) corresponds to midtones, relative to which you specify the dynamic range of the scene (where â€śblack evâ€ť controls how many stops you have below mid gray, and â€śwhite evâ€ť how many you have above it). The tone mapper will then make sure that the dyamic range so specified (i.e. white - black), which might be arbitrary, is compressed to fit within the dynamic range of the output (assumed to be in [0, 1]). This is done using the ACES formula for encoding from scene-linear to log (which you can find here). The formula is essentially this:

y = (log_2(x / sourceGray) - black) / (white - black)

[side note: letâ€™s ignore the â€śregularizationâ€ť slider, as itâ€™s not relevant in this discussion]

Then, once we have performed the tone mapping and converted to log, we go back to linear, but keeping the output in the [0,1] range. In this process, target gray is used to control where the input mid gray is remapped to relative to the output (i.e. target or â€śdisplayâ€ť) mid gray. This is the formula used in ART:

y = (base^x - 1) / (base - 1)

where base satisfies the following constraints:

\left\{
\begin{array}{l}
(base^{sourceGray} - 1) / (base - 1) = targetGray \\
base \ge 2
\end{array}
\right.

In practical terms, both sliders give you control on the brightness of your result, but they behave quite differently. Strictly speaking they are both somewhat redundant (you can use exposure compensation instead of source gray and tone curve instead of target gray), but I find them handy. I hope this helpsâ€¦