hanatos / vkdt

raw photography workflow that sucks less
https://jo.dreggn.org/vkdt
BSD 2-Clause "Simplified" License
380 stars 35 forks source link

[implementation] Painting for Dodging & Burning #3

Closed aurelienpierre closed 2 years ago

aurelienpierre commented 5 years ago

This is an differed answer on the IRC question

Goals of D&B

There are 3 main goals to dodging and burning:

  1. enhancing global contrast, usually to have better subject/background separation
  2. selectively adding more local contrast, usually on face features and body shapes, to increase depth and give a 3D feel, (this falls back to a make-up technic known as "contouring")
  3. selectively removing local contrast, usually in fashion/beauty shots, for examples eyes bags, ill-placed shadows, stretch marks, but keeping the fine skin texture untouched (example : use case, result).

Notice that the first goal is more easily covered by using an exposure compensation on areas defined by a guided filter mask (drawn or parametric), so this won't be covered here. Let's focus on the 2 others, that need actual painting.

D&B : Technic one, the bad

Create a grey layer, blend it in softlight or overlay mode, paint in white over areas to dodge, and black over areas to burn. Dodging and burning tools in PS/Gimp work around the same idea, just abstracting the initial grey layer.

https://youtu.be/4qsLJArkAe4?t=65

Why it's good:

Why it's bad :

D&B Technic : the ugly

Create "lightness up" and "lightness down" (gamma-like) adjustment (tone) curves, and paint over their opacity masks to uncover the desired areas.

https://youtu.be/ZeEXY2kIpVo?t=686

Why it's good :

Why it's bad :

D&B Technic : the good

Same logic as before, but instead of tone curves, create an "exposure up" and "exposure down" layers, simply using a linear scaling of the scene-linear RGB code values. Then, paint over their opacity masks to uncover desired areas.

Why it's good :

Tools of the trade

You mainly need round soft brushes painting pure white and pure black with some opacity.

But… Photoshop has another really nice feature to its brushes : the flow.

https://youtu.be/-4qeu-TZLp8?t=200

The flow is basically simulating how wet ink would add up in a continuous stroke, but also helps blending seamlessly different strokes together, especially using hard brushes. See how it affects dodging and burning:

https://youtu.be/-4qeu-TZLp8?t=562

For implementations of this, maybe look at https://github.com/briend/libmypaint (Brien has been working on spectral color mixing for digital painting, I believe he has serious physically-accurate brushes in there).

Maybe this is close to what we want here:

https://github.com/briend/libmypaint/blob/d52e6bcd158fcb19cd62343289b7b1ba716be633/brushmodes.c#L291

aurelienpierre commented 4 years ago

For later reference, about alpha matting:

hanatos commented 2 years ago

i'm going to say that this is implemented (the draw module has flow like self-blending and can be connected to exposure up/down, inpaint, wavelets, whatever really). if specific features are missing or ui is clumsy i'd suggest opening a more focussed issue.

i'll leave the other issue wrt alpha open, because carrying the fourth channel along as optional alpha is a different topic.