0
$\begingroup$

I've implemented a simple color burn function in one of my shaders and I understand the results (I think), but the math behind it, although simple, is unintuitive to me. I struggle to understand how would one invent this formula from scratch in search of the given effect. Could someone clarify how one comes from

"I need to increase the distance between the darkest and the lightest shades of the image."

to

"invert bottom layer and divide by the top layer, and then invert the result."

$\endgroup$

1 Answer 1

1
$\begingroup$

In general, notice that there is no particular reason for a blend mode or other color processing formula in an image manipulation program to be reasonable “from first principles” at all. All we care about is that, empirically, it produces an artistically useful result.

That said, we can make some useful observations about the structure of this particular operation:

  1. By inverting a color (that is, subtracting each component from 1), we can think of the resulting numbers as being “distance from white” in the same way that regular color components are “distance from black”. This preserves all the original information, but represents it differently.

  2. If you invert twice, you get the same color back. So, overall, the two inversions don't change the color; if we didn't do something in the middle, the overall operation would do nothing.

  3. Thus, we can think of the operation in the middle, the division as “operating in distance-from-white space”. By dividing by a number less than 1 (the value from the top layer), we scale up the distance-from-white of the color — darkening it.

Notice also that the “burn” in the name comes from film photography. The ordinary process of developing photographs inverts color twice (which is why the developed “negative” film is called that and looks the way it does), and dodging and burning were about manipulating the intensity of the light that fell on the print after passing through the negative. Thus, the digital/mathematical emulation of the technique also involves two inversions and a scaling, performed by optical and chemical processes.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.